adrenaline96

MalShare.NET Usage

Jun 22nd, 2018 (edited)
636
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.92 KB | None | 0 0
  1. using MalShare.NET;
  2.  
  3.  MSClient msc = new MSClient("API_KEY");
  4.  
  5. List<string> results = new List<string>();
  6. List<List<string>> resultsSearch = new List<List<string>>();
  7.  
  8.             resultsSearch = msc.Search("pastebin"); //Search sample hashes, sources and file names.
  9.  
  10.             results.AddRange(msc.SearchByType("pe32")); //List MD5/SHA1/SHA256 hashes of a specific type from the past 24 hours
  11.  
  12.             results.AddRange(msc.GetDetails("7453fb054d4eb6dc7f70b705ff8962f3")); //GET stored file details by its hash
  13.  
  14.             results.AddRange(msc.GetSources());  //List of sample sources from the past 24 hours
  15.  
  16.             results.AddRange(msc.GetHashList()); //List hashes from the past 24 hours
  17.            
  18.             Console.WriteLine(msc.Upload("virus.exe")); //Upload file to MalShare. Returns operation status
  19.            
  20.             results.AddRange(msc.GetRequestLimit()); //GET allocated number of API key requests per day and remaining
  21.            
  22.             results.AddRange(msc.GetTypeList()); //Get list of file types & count from the past 24 hours
  23.  
  24.             Console.WriteLine(msc.DownloadFile("a2fac8ea47e12e82ef766c3742800932")); //Download the file with the specified hash. Returns operation status
  25.  
  26.             Console.WriteLine(msc.UrlToCollection("http://217.160.43.70/2FIAKFw4U.exe")); //Perform URL download and add result to sample collection. Returns operation status
  27.  
  28.             Console.WriteLine(msc.UrlToCollection("http://217.160.43.70/2FIAKFw4U.exe", true)); //Perform URL download and add result to sample collection. The optional boolean "true" enables crawling the specified URL. Returns operation status
  29.  
  30.             Console.WriteLine(msc.CheckGUID("16d6c204-cc99-4000-8433-745dbdcd11b0")); //Check status of download task via GUID
  31.  
  32.             Console.WriteLine(msc.HashLookup("440f4036a3609ef6c22f153d2b1fee4e")); //Check if hash is present in database, return md5, sha1 and sha256 if so
Add Comment
Please, Sign In to add comment