Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Windows.Forms;
- using System.Net;
- using System.Text.RegularExpressions;
- using System.Drawing;
- using System.IO;
- namespace noDistributeScanner
- {
- class noDistribute
- {
- //CREDITS MUST BE GIVEN IF USED, LaPanthere is the author
- List<string> prox;
- Random r = new Random();
- public string resp = "";
- public void Initialize()
- {
- prox = methodHMA();
- }
- public List<ListViewItem> getResults(string filename, bool useproxy = false)
- {
- List<ListViewItem> lvis = new List<ListViewItem>();
- try
- {
- WebClient wc = new WebClient();
- if (useproxy)
- {
- wc.Proxy = getProxy();
- }
- wc.Headers.Add("Content-Type", "application/octet-stream");
- byte[] result = wc.UploadFile("http://nodistribute.com/scan/", filename);
- string response = Encoding.UTF8.GetString(result);
- resp = response;
- Regex reg = new Regex("<img class='.*?' src='../images/.*?.png'>.(.*)(?=<br)");
- foreach (Match m in reg.Matches(response))
- {
- string match = m.Groups[1].Value;
- string[] match2 = null;
- if (match.Contains(": "))
- {
- match2 = match.Split(new[] { ": " }, StringSplitOptions.None);
- }
- else
- {
- match2 = match.Split(new[] { ":" }, StringSplitOptions.None);
- }
- ListViewItem lvi = new ListViewItem(match2[0]);
- switch (match2[1])
- {
- case "Clean":
- lvi.ForeColor = Color.Green;
- break;
- default:
- lvi.ForeColor = Color.Red;
- break;
- }
- lvi.SubItems.Add(match2[1]);
- lvis.Add(lvi);
- }
- }
- catch (Exception ex)
- {
- ListViewItem lvix = new ListViewItem();
- if (ex.Message.Contains("remote server"))
- {
- lvix.ForeColor = Color.Red;
- lvix.Text = "Error";
- lvix.SubItems.Add("Couldn't connect to proxy, retrying with new proxy...");
- lvis.Add(lvix);
- lvis = getResults(filename, useproxy);
- }
- else
- {
- lvix.ForeColor = Color.Red;
- lvix.Text = "Error";
- lvix.SubItems.Add(ex.Message);
- lvis.Add(lvix);
- }
- }
- return lvis;
- }
- public string getDetections(string response)
- {
- string ret = "ERROR";
- try
- {
- Regex reg2 = new Regex("<strong>Result:</strong>.*");
- string[] splitting = null;
- foreach (Match m in reg2.Matches(response))
- {
- string match = HtmlRemoval.StripTagsRegex(m.Value);
- splitting = match.Split(new[] { "Result: " }, StringSplitOptions.None);
- ret = splitting[1];
- }
- }
- catch { }
- return ret;
- }
- public string getFilename(string response)
- {
- string ret = "ERROR";
- try
- {
- Regex reg2 = new Regex("<strong>Filename:</strong>.*");
- string[] splitting = null;
- foreach (Match m in reg2.Matches(response))
- {
- string match = HtmlRemoval.StripTagsRegex(m.Value);
- splitting = match.Split(new[] { "Filename: " }, StringSplitOptions.None);
- ret = splitting[1];
- }
- }
- catch { }
- return ret;
- }
- public string getMD5(string response)
- {
- string ret = "ERROR";
- try
- {
- Regex reg2 = new Regex("<strong>MD5:</strong>.*");
- string[] splitting = null;
- foreach (Match m in reg2.Matches(response))
- {
- string match = HtmlRemoval.StripTagsRegex(m.Value);
- splitting = match.Split(new[] { "MD5: " }, StringSplitOptions.None);
- ret = splitting[1];
- }
- }
- catch { }
- return ret;
- }
- public string getLink(string response)
- {
- string ret = "ERROR";
- try
- {
- Regex reg2 = new Regex("http://nodistribute.com/share/.*?(?=\")");
- string[] splitting = null;
- foreach (Match m in reg2.Matches(response))
- {
- //string match = HtmlRemoval.StripTagsRegex(m.Value);
- //splitting = match.Split(new[] { "Filename: " }, StringSplitOptions.None);
- ret = m.Value.Replace("share", "result");
- }
- }
- catch { }
- return ret;
- }
- public WebProxy getProxy()
- {
- if (prox.Count != 0)
- {
- int index = r.Next(prox.Count);
- string[] proxyport = prox[index].Split(':');
- //throw new Exception(proxyport[0]);
- return new WebProxy(proxyport[0], Convert.ToInt32(proxyport[1]));
- }
- return null;
- }
- public List<string> methodHMA()
- {
- List<string> buffer = new List<string>();
- for (int i = 1; i < 3; i++)
- {
- string html = doRequest("http://www.hidemyass.com/proxy-list/" + i);
- foreach (Match tr in new Regex("<tr.*?</tr>", RegexOptions.Singleline).Matches(html))
- {
- MatchCollection tdCollection = new Regex("<td.*?</td>", RegexOptions.Singleline).Matches(tr.Value);
- if (tdCollection.Count > 2 && tdCollection[1].Value.Length > 100)
- {
- List<string> noneStyle = new List<string>();
- string ip = tdCollection[1].Value.Replace("<td><span>", "").Replace("</span></td>", "");
- foreach (Match inline in new Regex(@"\..+?\{display:none\}").Matches(ip))
- {
- noneStyle.Add(inline.Value.Replace(".", "").Replace("{display:none}", ""));
- }
- ip = new Regex("<style>.*?</style>", RegexOptions.Singleline).Replace(ip, "");
- ip = new Regex("<span style=\"display:none\">.+?</span>", RegexOptions.Singleline).Replace(ip, "");
- ip = new Regex("<div style=\"display:none\">.+?</div>", RegexOptions.Singleline).Replace(ip, "");
- foreach (string s in noneStyle)
- {
- ip = new Regex("<span class=\"" + s + "\">.+?</span>").Replace(ip, "");
- ip = new Regex("<div class=\"" + s + "\">.+?</div>").Replace(ip, "");
- }
- ip = new Regex("<(span|div).+?>").Replace(ip, "");
- ip = new Regex("</(span|div)>").Replace(ip, "");
- buffer.Add(ip + ":" + tdCollection[2].Value.Replace("<td>", "").Replace("</td>", "").Replace("\r", "").Replace("\n", ""));
- }
- }
- }
- return buffer;
- }
- public string doRequest(string url, string cookie = "PHPSESSID=cvtr5gt9glfcc7d7eqa1svlsl4;")
- {
- HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
- req.Method = "GET";
- req.KeepAlive = true;
- req.Accept = "*/*";
- req.UserAgent = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36";
- req.ContentType = "application/x-www-form-urlencoded";
- req.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
- req.Headers.Add("Accept-Encoding", "gzip,deflate,sdch");
- req.Headers.Add("Accept-Language", "en-US,en;q=0.8");
- req.Headers.Add("Cookie", cookie);
- req.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
- req.Timeout = 5000;
- HttpWebResponse res = (HttpWebResponse)req.GetResponse();
- StreamReader sr = new StreamReader(res.GetResponseStream());
- string pageReturn = sr.ReadToEnd();
- return pageReturn;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement