Advertisement
Chris7S

Keyvault Checker Source

Jan 26th, 2014
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 11.88 KB | None | 0 0
  1. //Created by Chris Harris (Chris7S)
  2. //Created using Visual Studio 2012 (C#)
  3.  
  4. using System;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Data;
  8. using System.Drawing;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using System.Windows.Forms;
  13. using System.IO;
  14. using System.Net;
  15. using System.Runtime.InteropServices;
  16.  
  17. namespace Keyvault_Checker
  18. {
  19.     public partial class Form1 : Form
  20.     {
  21.         private string user = "chrisse7ensins@live.com";
  22.         private string pass = "se7ensinner123";
  23.         public int myInt = 0;
  24.  
  25.         const int FEATURE_DISABLE_NAVIGATION_SOUNDS = 21;
  26.         const int SET_FEATURE_ON_PROCESS = 0x00000002;
  27.  
  28.         [DllImport("urlmon.dll")]
  29.         [PreserveSig]
  30.         [return: MarshalAs(UnmanagedType.Error)]
  31.         static extern int CoInternetSetFeatureEnabled(
  32.             int FeatureEntry,
  33.             [MarshalAs(UnmanagedType.U4)] int dwFlags,
  34.             bool fEnable);
  35.  
  36.         public Form1()
  37.         {
  38.             InitializeComponent();
  39.         }
  40.  
  41.         static void disableClickSounds()
  42.         {
  43.             CoInternetSetFeatureEnabled(
  44.                 FEATURE_DISABLE_NAVIGATION_SOUNDS,
  45.                 SET_FEATURE_ON_PROCESS,
  46.                 true);
  47.         }
  48.  
  49.         static void enableClickSounds()
  50.         {
  51.             CoInternetSetFeatureEnabled(
  52.                 FEATURE_DISABLE_NAVIGATION_SOUNDS,
  53.                 SET_FEATURE_ON_PROCESS,
  54.                 false);
  55.         }
  56.  
  57.         private void Form1_Load(object sender, EventArgs e)
  58.         {
  59.             this.Text = "Keyvault Checker - v" + Application.ProductVersion;
  60.             disableClickSounds();
  61.             wbXboxLive.Navigate("https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=12&ct=1390286445&rver=6.4.6456.0&wp=MBI_SSL&wreply=https:%2F%2Flive.xbox.com:443%2Fxweb%2Flive%2Fpassport%2FsetCookies.ashx%3Frru%3Dhttps%253a%252f%252flive.xbox.com%252fen-US%252fAccount%252fSignin%253freturnUrl%253dhttps%253a%252f%252fenforcement.xbox.com%252fHome%252fMsaCallback&lc=1033&id=66262&cbcxt=0");
  62.         }
  63.  
  64.         private void closeToolStripMenuItem_Click(object sender, EventArgs e)
  65.         {
  66.             Application.Exit();
  67.         }
  68.  
  69.         private void button1_Click(object sender, EventArgs e)
  70.         {
  71.             OpenFileDialog openFileDialog1 = new OpenFileDialog();
  72.             openFileDialog1.Filter = "Bin Files (.bin)|*.bin|All Files (*.*)|*.*";
  73.             openFileDialog1.FilterIndex = 1;
  74.             openFileDialog1.Title = "Open Keyvault";
  75.             openFileDialog1.FileName = "KV.bin";
  76.  
  77.             if (openFileDialog1.ShowDialog() == DialogResult.OK)
  78.             {
  79.                 try
  80.                 {
  81.                     BinaryReader br = new BinaryReader(new MemoryStream(File.ReadAllBytes(openFileDialog1.FileName)));
  82.                     br.BaseStream.Position = 0xB0;
  83.                     byte[] array = br.ReadBytes(0xC);
  84.                     long value0 = long.Parse(ASCIIEncoding.ASCII.GetString(array));
  85.                     string value1 = value0.ToString();
  86.                     label1.Text = "Console Serial Number - " + value1;
  87.                     textBox2.Text = value1;
  88.                     textBox1.Text = openFileDialog1.FileName;
  89.                     label2.Enabled = true;
  90.                     progressBar1.Enabled = true;
  91.                     comboBox1.Enabled = true;
  92.                     toolStripStatusLabel2.Text = "Keyvault Opened Successfully";
  93.                     if (textBox2.TextLength == 11)
  94.                     {
  95.                         label1.Text = "Console Serial Number - 0" + value1;
  96.                         textBox2.Text = "Console Serial Number - 0" + value1;
  97.                     }
  98.                     else
  99.                     {
  100.                         label1.Text = "Console Serial Number - " + value1;
  101.                     }
  102.                 }
  103.                 catch
  104.                 {
  105.                     MessageBox.Show("An error has occurred. Please try again!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  106.                 }
  107.             }
  108.         }
  109.  
  110.         private void openKeyvaultToolStripMenuItem_Click(object sender, EventArgs e)
  111.         {
  112.             OpenFileDialog openFileDialog1 = new OpenFileDialog();
  113.             openFileDialog1.Filter = "Bin Files (.bin)|*.bin|All Files (*.*)|*.*";
  114.             openFileDialog1.FilterIndex = 1;
  115.             openFileDialog1.Title = "Open Keyvault";
  116.             openFileDialog1.FileName = "KV.bin";
  117.  
  118.             if (openFileDialog1.ShowDialog() == DialogResult.OK)
  119.             {
  120.                 try
  121.                 {
  122.                     BinaryReader br = new BinaryReader(new MemoryStream(File.ReadAllBytes(openFileDialog1.FileName)));
  123.                     br.BaseStream.Position = 0xB0;
  124.                     byte[] array = br.ReadBytes(0xC);
  125.                     long value0 = long.Parse(ASCIIEncoding.ASCII.GetString(array));
  126.                     string value1 = value0.ToString();
  127.                     textBox2.Text = value1;
  128.                     textBox1.Text = openFileDialog1.FileName;
  129.                     label2.Enabled = true;
  130.                     progressBar1.Enabled = true;
  131.                     comboBox1.Enabled = true;
  132.                     toolStripStatusLabel2.Text = "Keyvault Opened Successfully";
  133.                     if (textBox2.TextLength == 11)
  134.                     {
  135.                         label1.Text = "Console Serial Number - 0" + value1;
  136.                         textBox2.Text = "Console Serial Number - 0" + value1;
  137.                     }
  138.                     else
  139.                     {
  140.                         label1.Text = "Console Serial Number - " + value1;
  141.                     }
  142.                 }
  143.                 catch
  144.                 {
  145.                     MessageBox.Show("An error has occurred. Please try again!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  146.                 }
  147.             }
  148.         }
  149.  
  150.         private void button2_Click(object sender, EventArgs e)
  151.         {
  152.             timer1.Start();
  153.             wbXboxLive.Document.GetElementById("i0116").SetAttribute("value", user);
  154.             wbXboxLive.Document.GetElementById("i0118").SetAttribute("value", pass);
  155.             wbXboxLive.Document.GetElementById("idSIButton9").InvokeMember("click");
  156.         }
  157.  
  158.         private void timer1_Tick(object sender, EventArgs e)
  159.         {
  160.             progressBar1.Increment(+1);
  161.             label2.Text = progressBar1.Value + "%";
  162.  
  163.             if (progressBar1.Value == 1)
  164.             {
  165.                 toolStripStatusLabel2.Text = "Connecting to Xbox Live Server...";
  166.             }
  167.             else if (progressBar1.Value == 20)
  168.             {
  169.                 wbXboxLive.Navigate("https://enforcement.xbox.com/Home/ConsoleCheck?Length=4");
  170.             }
  171.             else if (progressBar1.Value == 40)
  172.             {
  173.                 toolStripStatusLabel2.Text = "Checking Keyvault for Flags...";
  174.                 if (comboBox1.Text == "Select Console Type")
  175.                 {
  176.                     MessageBox.Show("Please Select a Console Type", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  177.                 }
  178.                 else if (comboBox1.Text == "original Xbox 360")
  179.                 {
  180.                     wbXboxLive.Document.GetElementById("e_selectConsole").SetAttribute("option", "Xbox360");
  181.                 }
  182.                 else if (comboBox1.Text == "Xbox 360 S")
  183.                 {
  184.                     wbXboxLive.Document.GetElementById("e_selectConsole").SetAttribute("value", "Xbox360S");
  185.                 }
  186.                 else if (comboBox1.Text == "Xbox 360 E")
  187.                 {
  188.                     wbXboxLive.Document.GetElementById("e_selectConsole").SetAttribute("option", "Xbox360E");
  189.                 }
  190.  
  191.                 wbXboxLive.Document.GetElementById("e_serialNo").SetAttribute("value", textBox2.Text);
  192.             }
  193.             else if (progressBar1.Value == 60)
  194.             {
  195.                 toolStripStatusLabel2.Text = "Returning Keyvault Results...";
  196.                 wbXboxLive.Document.GetElementById("e_iReadTou").InvokeMember("click");
  197.                 wbXboxLive.Document.GetElementById("e_lookupConsole").InvokeMember("click");
  198.                 progressBar1.Increment(+2);
  199.             }
  200.             else if (progressBar1.Value == 80)
  201.             {
  202.                 textBox3.Text = wbXboxLive.Document.GetElementById("e_msgbarText").InnerHtml.ToString();
  203.                 progressBar1.Increment(+3);
  204.             }
  205.             else if (progressBar1.Value == 100)
  206.             {
  207.                 if (textBox3.Text.Contains("No enforcement action found."))
  208.                 {
  209.                     toolStripStatusLabel2.ForeColor = System.Drawing.Color.Green;
  210.                     toolStripStatusLabel2.Text = "Keyvault Unbanned";
  211.                     timer1.Stop();
  212.                     checkBox1.Enabled = true;
  213.                     checkBox1.Visible = true;
  214.                 }
  215.                 else if (textBox3.Text.Contains("Console check limit exceeded."))
  216.                 {
  217.                     toolStripStatusLabel2.ForeColor = System.Drawing.Color.Red;
  218.                     toolStripStatusLabel2.Text = "Console check limit exceeded. Try again later.";
  219.                     timer1.Stop();
  220.                     checkBox1.Enabled = true;
  221.                     checkBox1.Visible = true;
  222.                 }
  223.                 else if (textBox3.Text.Contains("Our records indicate this console has been banned"))
  224.                 {
  225.                     toolStripStatusLabel2.ForeColor = System.Drawing.Color.Red;
  226.                     toolStripStatusLabel2.Text = "Keyvault Banned";
  227.                     timer1.Stop();
  228.                     checkBox1.Enabled = true;
  229.                     checkBox1.Visible = true;
  230.                 }
  231.             }
  232.         }
  233.  
  234.         private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  235.         {
  236.             if (comboBox1.Text == "Select Console Type")
  237.             {
  238.                 //Do nothing.
  239.             }
  240.             else
  241.             {
  242.                 button2.Enabled = true;
  243.             }
  244.         }
  245.  
  246.         private void Form1_FormClosing(object sender, FormClosingEventArgs e)
  247.         {
  248.             enableClickSounds();
  249.         }
  250.  
  251.         private void checkBox1_CheckedChanged(object sender, EventArgs e)
  252.         {
  253.             if (checkBox1.Checked == true)
  254.             {
  255.                 comboBox1.Enabled = false;
  256.                 comboBox1.Text = "Select Console Type";
  257.                 textBox1.Text = "";
  258.                 button2.Enabled = false;
  259.                 checkBox1.Enabled = false;
  260.                 checkBox1.Visible = false;
  261.                 label1.Text = "Console Serial Number -          -N/A-      ";
  262.                 progressBar1.Value = 0;
  263.                 label2.Text = progressBar1.Value + "%";
  264.                 toolStripStatusLabel2.Text = "Idle";
  265.             }
  266.         }
  267.  
  268.         private void toolStripButton1_Click(object sender, EventArgs e)
  269.         {
  270.             MessageBox.Show("Keyvault Checker v" + Application.ProductVersion + "\n \n" + "Created by Chris Harris (Chris 7S)", "About Keyvault Checker", MessageBoxButtons.OK, MessageBoxIcon.Information);
  271.         }
  272.  
  273.         private void toolStripButton2_Click(object sender, EventArgs e)
  274.         {
  275.             System.Diagnostics.Process.Start("http://www.youtube.com/InModWeTrust360");
  276.         }
  277.  
  278.         private void toolStripButton3_Click(object sender, EventArgs e)
  279.         {
  280.             System.Diagnostics.Process.Start("http://www.facebook.com/InModWeTrust360");
  281.         }
  282.  
  283.         private void toolStripButton4_Click(object sender, EventArgs e)
  284.         {
  285.             System.Diagnostics.Process.Start("http://www.twitter.com/InModWeTrust360");
  286.         }
  287.  
  288.         private void toolStripButton5_Click(object sender, EventArgs e)
  289.         {
  290.             System.Diagnostics.Process.Start("http://www.instagram.com/InModWeTrust360");
  291.         }
  292.     }
  293. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement