//Code: Darkred for Defcon 20
//Compile with C# for .Net 3.5
//Products: Apple
//Program Goal: Make some lenovo serials for the bulk checker
//Bulk checker is located at https://services.lenovo.com/ibapp/il/WarrantyLookupBatch.jsp , just upload the .csv that comes out of this program
//The bulk checker input format is as follows "Model(not needed),Serial,Comment(not needed)" in comma seperated value format (*.csv)
//The bulk checker output format is as follows "ProductID,Model Part1,Model Part2,Serial,Comment,Warranty?,Warranty end date,Warranty upgrade end date" 
//This application generates a file called lenovo.csv which when fed into the bulk checker will return the status of 1296 unique serials
//Status: Some invalid, Others valid. Code is somewhat clean
using System;
using System.Linq;
using System.Text;
using System.IO;
namespace LenovoCSV
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Title = "Lenovo CSV generator";
            String charSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; //All the valid characters
            String baseStr = "LR3A1"; //Lenovo Thinkpad X120e
            StreamWriter write = new StreamWriter(@"lenovo.csv");//Where to save the file
            int serialCnt = 0; //keeps track for the comment
            String dirName = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); 
            Console.WriteLine("Generating the CSV file, this will only take a second");
            for (int i = 0; i < charSet.Length ; i++)
            {
                for (int x = 0; x < charSet.Length; x++)
                {
                    serialCnt++;
                    write.WriteLine("," + baseStr + charSet[i] + charSet[x] + ",Serial:" +serialCnt );
                }
            }
            write.Close();
            Console.WriteLine("Done generating, File saved as  " + dirName + "\\lenovo.csv");
            Console.WriteLine("Press enter to continue...");
            Console.ReadLine();
        }
    }
}
