0

I created a web request with post data then getting a response telling me if it contained something, and my question is on how to also capture something else from the response and write that in the console. Do I have to create a separate GET request? and how would i do that, and how do you get something from the get request and write that into the console.

https://i.stack.imgur.com/jDSyF.jpg

try
{
    WebResponse webResponse = (HttpWebResponse)httpWebRequest.GetResponse();
    Program.logincookie = cookieContainer;
    StreamReader streamReader = new StreamReader(webResponse.GetResponseStream());
    string text4 = streamReader.ReadToEnd();
    streamReader.Close();
    webResponse.Close();



    if (!text4.Contains("Invalid username/password."))
    {
        Console.ForegroundColor = ConsoleColor.Green;

        Console.WriteLine("[HIT] " + email + ":" + password);


        File.AppendAllText("hits.txt", email + ":" + password + Environment.NewLine);
        Valid++;

    }
    else
    {
        Console.ForegroundColor = ConsoleColor.Red;
        Console.WriteLine("[BAD] " + email + ":" + password);
        Invalid++;
    }
}
catch (Exception)
{
    Console.ForegroundColor = ConsoleColor.DarkRed;
    Console.WriteLine("[BAD] " + email + ":" + password);
    Invalid++;
}
Gabriel Luci
  • 38,328
  • 4
  • 55
  • 84
  • You mean like `Console.WriteLine(text4)`? – Gabriel Luci Nov 26 '18 at 01:35
  • No, like get something and write it FROM the webresponse. – Michael Fox Nov 26 '18 at 01:40
  • I don't understand what you mean. You want to read a specific part of the response? – Gabriel Luci Nov 26 '18 at 01:41
  • You already read the whole response. I want to take something from the response and write it in the console using Console.WriteLine – Michael Fox Nov 26 '18 at 01:45
  • You have the whole response in a `string` called `text4`. So you can do whatever you want with it now. It depends what you want from it. Use any of the [`String`](https://learn.microsoft.com/en-us/dotnet/api/system.string) methods (like [`Substring()`](https://learn.microsoft.com/en-us/dotnet/api/system.string.substring)) and take what you want from it. – Gabriel Luci Nov 26 '18 at 01:54
  • yeah, i know but my question was if the response was 'valid' how would i get like some WORDS from the response like ex, points 400. into the console – Michael Fox Nov 26 '18 at 01:58
  • I think we're misunderstanding each other. Can you edit your question and show the full content of the response and then what you would like the output to the console to look like? – Gabriel Luci Nov 26 '18 at 02:02
  • just added the whole request and response – Michael Fox Nov 26 '18 at 02:08
  • I meant the content of the response - the actual text that you get back from the server. What does it look like? And what text do you want to output to the console? – Gabriel Luci Nov 26 '18 at 02:10
  • i put an imgur link of how it looks. – Michael Fox Nov 26 '18 at 02:19
  • So then what do you want the output to the console to look like? – Gabriel Luci Nov 26 '18 at 02:21
  • the bads are just codes that don't work, i want to scrape information and put it into the console if the code is working. like whatever is on the page, the amount, the name. – Michael Fox Nov 26 '18 at 02:22
  • like [Good]CODE, additonal information from response, more info – Michael Fox Nov 26 '18 at 02:22
  • I meant what do you *want* the output to look like? - not what does it look like now :) what information is in the response that you want to use? – Gabriel Luci Nov 26 '18 at 02:24
  • like [Good]CODE, value of the code, name – Michael Fox Nov 26 '18 at 02:29
  • What is "CODE"? What is "value of the code"? What is "name"? Where is all that information coming from? – Gabriel Luci Nov 26 '18 at 02:31
  • [Good]CODE(already have this.), money on the code, name of the game. CODE = THE game code Money = The game money on the code and the name is the name of the code. These are the additional things i need from the response if the code is VALID, to output or write it into the CONSOLE. – Michael Fox Nov 26 '18 at 02:47
  • Then read it from `text4`. – Gabriel Luci Nov 26 '18 at 03:08

0 Answers0