Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text.RegularExpressions;
- using System.Net;
- using System.Net.Http;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- namespace Rextester
- {
- public class Program
- {
- //------------------------------------------------------------------------------------------------------------------------------------Collection Finder
- static void CollectionFinder(string accessKey, string secretKey)
- {
- string URL = "https://visagecloud.com/rest/v1.1/collection/all?" + "accessKey=" + accessKey + "&secretKey=" + secretKey;
- HttpWebRequest WebReq =
- (HttpWebRequest)WebRequest.Create(URL);
- WebReq.Method = "GET";
- WebReq.ContentType = "application/json";
- Console.WriteLine("looking for collections");
- //WebReq.ContentLength = buffer.Length;
- //HttpWebResponse response = (HttpWebResponse)WebReq.GetResponse();
- //Stream stream = response.GetResponseStream(); <----------------We tried this, but no luck
- //StreamReader myreader = new StreamReader(stream);
- //Stream PostData = WebReq.GetRequestStream(); //<=========================== Cannot send a content-body with this verb-type
- //PostData.Write(buffer, 0, buffer.Length);
- //PostData.Close();
- //HttpWebResponse WebResp = null;
- try
- {
- var WebResp = (HttpWebResponse)WebReq.GetResponse();
- //Let's show some information about the response
- Console.WriteLine(WebResp.StatusCode);
- Console.WriteLine(WebResp.Server);
- using (var mystream = WebResp.GetResponseStream())
- {
- //Stream Answer = WebResp.GetResponseStream();
- using (var RDR = new StreamReader(mystream))
- {
- Console.WriteLine(RDR.ReadToEnd());
- }
- }
- //Now, we read the response (the string), and output it.
- //string[] lines = new[] { _Answer.ReadToEnd() };
- //System.IO.File.WriteAllLines(@"C:\Users\coled\Desktop\DrowningFlounderv0.1\Cdefault.txt", lines);
- //StreamReader reader = File.OpenText(@"C:\Users\coled\Desktop\DrowningFlounderv0.1\Cdefault.txt");
- }
- catch (WebException webex)
- {
- WebResponse errResp = webex.Response;
- using (Stream respStream = errResp.GetResponseStream())
- {
- StreamReader reader = new StreamReader(respStream);
- string text = reader.ReadToEnd();
- Console.WriteLine(text);
- }
- }
- }
- //---------------------------------------------------------------------------------------------------------------------------------- Collection Maker
- static void CollectionMaker(string accessKey, string secretKey)
- {
- string userCollection;
- Console.WriteLine("Please enter a collection name");
- userCollection = Console.ReadLine();
- byte[] buffer = Encoding.ASCII.GetBytes("accessKey=" + accessKey + "&secretKey=" + secretKey + "&collectionName=" + userCollection);
- HttpWebRequest WebReq =
- (HttpWebRequest)WebRequest.Create("https://visagecloud.com/rest/v1.1/collection/collection");
- WebReq.Method = "POST";
- WebReq.ContentType = "application/x-www-form-urlencoded";
- Console.WriteLine("creating collection named " + userCollection);
- WebReq.ContentLength = buffer.Length;
- Stream PostData = WebReq.GetRequestStream();
- PostData.Write(buffer, 0, buffer.Length);
- PostData.Close();
- HttpWebResponse WebResp = null;
- if (!File.Exists(@"C:\Users\coled\Desktop\DrowningFlounderv0.1\Cdefault.txt"))
- {
- var CdefaultTxt = File.Create(@"C:\Users\coled\Desktop\DrowningFlounderv0.1\Cdefault.txt");
- CdefaultTxt.Close();
- }
- try
- {
- WebResp = (HttpWebResponse)WebReq.GetResponse();
- //Let's show some information about the response
- Console.WriteLine(WebResp.StatusCode);
- Console.WriteLine(WebResp.Server);
- Console.WriteLine(WebResp.GetResponseStream());
- //Now, we read the response (the string), and output it.
- Stream Answer = WebResp.GetResponseStream();
- StreamReader _Answer = new StreamReader(Answer);
- string[] lines = new[] { _Answer.ReadToEnd() };
- System.IO.File.WriteAllLines(@"C:\Users\coled\Desktop\DrowningFlounderv0.1\Cdefault.txt", lines);
- StreamReader reader = File.OpenText(@"C:\Users\coled\Desktop\DrowningFlounderv0.1\Cdefault.txt");
- }
- catch (WebException webex)
- {
- WebResponse errResp = webex.Response;
- using (Stream respStream = errResp.GetResponseStream())
- {
- StreamReader reader = new StreamReader(respStream);
- string text = reader.ReadToEnd();
- Console.WriteLine(text);
- }
- }
- }
- //-------------------------------------------------------------------------------------------------------------------------------------------------------------------Face hash finder
- static void FaceHashFinder(string accessKey, string secretKey)
- {
- //Our postvars
- string URL = "https%3A%2F%2Fscontent-amt2-1.xx.fbcdn.net%2Fv%2Ft1.0-9%2F19511355_10209597279392017_7285589497372752431_n.jpg%3Foh%3D800858c4be404d03d33e5425d469369c%26oe%3D59D47AEC";
- byte[] buffer = Encoding.ASCII.GetBytes("accessKey=" + accessKey + "&secretKey=" + secretKey + "&pictureURL=" + URL);
- //Initialization, we use localhost, change if applicable
- HttpWebRequest WebReq =
- (HttpWebRequest)WebRequest.Create("https://visagecloud.com/rest/v1.1/analysis/detection");
- //Our method is post, otherwise the buffer (postvars) would be useless
- WebReq.Method = "POST";
- //We use form contentType, for the postvars.
- WebReq.ContentType = "application/x-www-form-urlencoded";
- Console.WriteLine("end here plox");
- //The length of the buffer (postvars) is used as contentlength.
- WebReq.ContentLength = buffer.Length;
- //We open a stream for writing the postvars
- Stream PostData = WebReq.GetRequestStream();
- //Now we write, and afterwards, we close. Closing is always important!
- PostData.Write(buffer, 0, buffer.Length);
- PostData.Close();
- //Get the response handle, we have no true response yet!
- HttpWebResponse WebResp = null;
- try
- {
- WebResp = (HttpWebResponse)WebReq.GetResponse();
- //Let's show some information about the response
- Console.WriteLine(WebResp.StatusCode);
- Console.WriteLine(WebResp.Server);
- Console.WriteLine(WebResp.GetResponseStream());
- //Now, we read the response (the string), and output it.
- Stream Answer = WebResp.GetResponseStream();
- StreamReader _Answer = new StreamReader(Answer);
- //Console.WriteLine(_Answer.ReadToEnd());
- //-----------------------------------------------------------------------------------------------
- //FILE CREATION AND CHECKS
- if(!File.Exists(@"C:\Users\coled\Desktop\DrowningFlounderv0.1\default.txt"))
- {
- var defaultTxt = File.Create(@"C:\Users\coled\Desktop\DrowningFlounderv0.1\default.txt");
- defaultTxt.Close();
- }
- if (!File.Exists(@"C:\Users\coled\Desktop\DrowningFlounderv0.1\hash.txt"))
- {
- var hashTxt = File.Create(@"C:\Users\coled\Desktop\DrowningFlounderv0.1\hash.txt");
- hashTxt.Close();
- }
- //makes system wait for 2 seconds
- Console.WriteLine("Waiting for 2 seconds");
- System.Threading.Thread.Sleep(2000);
- //-----------------------------------------------------------------------------------------------------
- string[] lines = new[] { _Answer.ReadToEnd() };
- System.IO.File.WriteAllLines(@"C:\Users\coled\Desktop\DrowningFlounderv0.1\default.txt", lines);
- StreamReader reader = File.OpenText(@"C:\Users\coled\Desktop\DrowningFlounderv0.1\default.txt");
- string readerLine;
- int val;
- string hash = "poop";
- while ((readerLine = reader.ReadLine()) != null)
- {
- val = readerLine.IndexOf("hash\":\"");
- hash = readerLine.Substring(val + 7, 64);
- }
- string[] cHash = new[] { hash };
- System.IO.File.WriteAllLines(@"C:\Users\coled\Desktop\DrowningFlounderv0.1\hash.txt", cHash);
- //-----------------------------------------------------------------------------------------------
- Console.WriteLine("end of code");
- }
- catch (WebException webex)
- {
- WebResponse errResp = webex.Response;
- using (Stream respStream = errResp.GetResponseStream())
- {
- StreamReader reader = new StreamReader(respStream);
- string text = reader.ReadToEnd();
- Console.WriteLine(text);
- }
- }
- return;
- } //----------------End of Function "FaceHashFinder"----------------------//
- //-------------------------------------------------------------------------------------------------------------------------------------Main
- public static void Main(string[] args)
- {
- string accessKey = "5ho8s6ukulohb5ermcl08ibgj2i4rph9ukjsteb8afuc2dia";
- string secretKey = "tjhjjkbqeo743smsgqc59k2gsl1j0icb4itriuk28opo20fm9vac9ck5cbu71st5b93gk44pitg6g4i2erhtaedau6d4unno";
- string CollUserInput;
- Program.CollectionFinder(accessKey, secretKey);
- // calling for program FaceHashFinder
- //Program first = new Program();
- do
- {
- Console.WriteLine("Using Collection Cole");
- Console.WriteLine("Collection ID: 2ajjmstnj3io4srt0eolrka52lvihbgsumndudulngj8i2dvcf75b186je6q95t5");
- CollUserInput = Console.ReadLine();
- Console.WriteLine(CollUserInput);
- } while (!CollUserInput.Equals("Y") && !CollUserInput.Equals("N"));
- if (CollUserInput == "Y")
- {
- Console.WriteLine("creating collection");
- //Program.CollectionMaker(accessKey, secretKey);
- }
- else if (CollUserInput == "N")
- {
- Console.WriteLine("Fine, fuck you then.");
- }
- Program.FaceHashFinder(accessKey, secretKey);
- Console.WriteLine("end of main");
- }
- }
- }
- /*
- using System;
- using System.Net;
- using System.Net.Http;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- //Our postvars
- byte[] buffer = Encoding.ASCII.GetBytes("faceHash=5738de51cb8325c385dd41e0eb169adcca9498dbb68bb33e4592f4a6795f15eb&accessKey=5ho8s6ukulohb5ermcl08ibgj2i4rph9ukjsteb8afuc2dia&secretKey=tjhjjkbqeo743smsgqc59k2gsl1j0icb4itriuk28opo20fm9vac9ck5cbu71st5b93gk44pitg6g4i2erhtaedau6d4unno&collectionId=ulqemhvcf0c6is65p9h0lsmtprc8nl83d6411o075td1cetaidt3a8urmbtvcr3j&profileId=opu12q8sjgvib9pe3g0fanh73ohietjdgltn1t6j76kvfuv8je5an14ai9a05gtg&=");
- //Initialization, we use localhost, change if applicable
- HttpWebRequest WebReq =
- (HttpWebRequest)WebRequest.Create("https://visagecloud.com/rest/v1.1/profile/map");
- //Our method is post, otherwise the buffer (postvars) would be useless
- WebReq.Method = "POST";
- //We use form contentType, for the postvars.
- WebReq.ContentType = "application/x-www-form-urlencoded";
- Console.WriteLine("end here plox");
- //The length of the buffer (postvars) is used as contentlength.
- WebReq.ContentLength = buffer.Length;
- //We open a stream for writing the postvars
- Stream PostData = WebReq.GetRequestStream();
- //Now we write, and afterwards, we close. Closing is always important!
- PostData.Write(buffer, 0, buffer.Length);
- PostData.Close();
- //Get the response handle, we have no true response yet!
- HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();
- //Let's show some information about the response
- Console.WriteLine(WebResp.StatusCode);
- Console.WriteLine(WebResp.Server);
- //Now, we read the response (the string), and output it.
- Stream Answer = WebResp.GetResponseStream();
- StreamReader _Answer = new StreamReader(Answer);
- Console.WriteLine(_Answer.ReadToEnd());
- Console.WriteLine("end of code");
- //Congratulations, you just requested your first POST page, you
- //can now start logging into most login forms, with your application
- //Or other examples.
- }
- }
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement