Advertisement
BaSs_HaXoR

Sticky's IDC Builder Source C#

Nov 2nd, 2014
645
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.71 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.IO;
  11.  
  12. namespace Advanced_IDC_Script_Creator___By_Sticky
  13. {
  14.     public partial class Form1 : Form
  15.     {
  16.         public Form1()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.  
  21.         public int IDCFuncAmount = 0;
  22.  
  23.         public string AddToIDC()
  24.         {
  25.             return "    UpdateAddress(\"" + textBox6.Text + "\", " + "\"" + textBox7.Text + "\", " + textBox9.Text + ", " + textBox8.Text + ");" + Environment.NewLine;
  26.         }
  27.  
  28.         public static byte[] GetBytesFromFile(string fullFilePath)
  29.         {
  30.             FileStream fs = null;
  31.             try
  32.             {
  33.                 fs = File.OpenRead(fullFilePath);
  34.                 byte[] bytes = new byte[fs.Length];
  35.                 fs.Read(bytes, 0, Convert.ToInt32(fs.Length));
  36.                 return bytes;
  37.             }
  38.             finally
  39.             {
  40.                 if (fs != null)
  41.                 {
  42.                     fs.Close();
  43.                     fs.Dispose();
  44.                 }
  45.             }
  46.         }
  47.  
  48.         private void button1_Click(object sender, EventArgs e)
  49.         {
  50.             if (textBox6.Text != "" && textBox7.Text != "" && textBox8.Text != "" && textBox9.Text != "")
  51.             {
  52.                 label9.Text = "Functions Added: " + IDCFuncAmount.ToString();
  53.                 if (IDCFuncAmount < 1)
  54.                     textBox10.Text += "static UpdateOffsets()" + Environment.NewLine + "{" + Environment.NewLine + AddToIDC();
  55.                 else
  56.                     textBox10.Text += AddToIDC();
  57.                 IDCFuncAmount++;
  58.                 MessageBox.Show(textBox6.Text + " has been added to the IDC script!", "Function Added", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  59.                 textBox6.Text = "";
  60.                 textBox7.Text = "";
  61.                 textBox9.Text = "";
  62.             }
  63.             else
  64.                 MessageBox.Show("Please make sure to fill in all inquiries before adding function to the IDC!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  65.         }
  66.  
  67.         private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  68.         {
  69.             MessageBox.Show("Function name is how the updated offset will be output when the IDC is loaded into IDA... So if the function name is SetClientViewAngles, the offset that is found will be labled as SetClientViewAngles!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
  70.         }
  71.  
  72.         private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  73.         {
  74.             MessageBox.Show("These bytes are completely unique to this address, you should not be able to find a reoccurance of these bytes. If there are reoccurances of the bytes it will not find the correct offset!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
  75.         }
  76.  
  77.         private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  78.         {
  79.             MessageBox.Show("This is the length of the bytes default is 0x1B8. So 0x1B8 bytes would be like this 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
  80.         }
  81.  
  82.         private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  83.         {
  84.             MessageBox.Show("The offset is the difference from the address where the unique bytes were found from where the address is. So if the address is 0x120040E5, and the bytes were found at 0x120040F5, the offset would be 0x10!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
  85.         }
  86.  
  87.         private void howToUseToolStripMenuItem_Click(object sender, EventArgs e)
  88.         {
  89.             MessageBox.Show("To use these load the .elf of the game you want to update offsets for in IDA, then click File > Script File, and select the .idc file you wish to load, the address's or whatever should print to the output window if done correctly.", "How to Use", MessageBoxButtons.OK, MessageBoxIcon.Information);
  90.         }
  91.  
  92.         private void Form1_Load(object sender, EventArgs e)
  93.         {
  94.             textBox10.ReadOnly = true;
  95.             textBox10.BackColor = Color.White;
  96.         }
  97.  
  98.         private void creditsToolStripMenuItem_Click(object sender, EventArgs e)
  99.         {
  100.             MessageBox.Show("Sticky - Creating the tool\nNotorious - Teaching me stuff\nGodly - Original IDC script", "Credits", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  101.         }
  102.  
  103.         private void saveIDCToolStripMenuItem_Click(object sender, EventArgs e)
  104.         {
  105.             SaveFileDialog saveFileDialog = new SaveFileDialog();
  106.                 DialogResult dialogResult = saveFileDialog.ShowDialog();
  107.  
  108.             textBox10.Text += Environment.NewLine + "}" + Environment.NewLine + "static main()" + Environment.NewLine + "{" + Environment.NewLine + "    UpdateOffsets();" + Environment.NewLine + "    return 0;" + Environment.NewLine + "}";
  109.  
  110.             if (dialogResult == DialogResult.OK)
  111.             {
  112.                 File.WriteAllText(saveFileDialog.FileName + ".idc", textBox10.Text);
  113.             }
  114.             MessageBox.Show("Your IDC has been saved, go to the information tab to see how to use it!", "File Saved", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  115.         }
  116.  
  117.         private void contactToolStripMenuItem_Click(object sender, EventArgs e)
  118.         {
  119.             MessageBox.Show("Skype: live:formerlymalicious", "Contact Info", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  120.         }
  121.     }
  122. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement