How can I make GET request to the API and then save the HTTP status code?
Nov 6, 2016 02:13 PM
(This post was last modified: Nov 6, 2016 02:14 PM by Papa Cuda.)
Are you talking about banner grabbing, like with net cat or telnet?
Earning for the year 2017:
super spooky
(Nov 6, 2016 02:13 PM)Papa Cuda Wrote: Are you talking about banner grabbing headers? Basically, I want to do something like
GET http://api.domain.com/profiles/<input>
Then save the code it returns (403, 404, etc)
Nov 6, 2016 02:17 PM
(This post was last modified: Nov 6, 2016 02:19 PM by Papa Cuda.)
(Nov 6, 2016 02:14 PM)Egregious Jr. Wrote: Basically, I want to do something like
GET http://api.domain.com/profiles/<input>
Then save the code it returns (403, 404, etc)
If I'm understanding you correctly open a terminap and type
PHP Code
<?php nc -v targetip > codereturns.txt
Then
PHP Code
<?php GET / HTTP / 1.1 Host: target ip
I think this is what you want? IF it's not I apologize and I'll reform my answer.
Earning for the year 2017:
super spooky
(Nov 6, 2016 02:17 PM)Papa Cuda Wrote: If I'm understanding you correctly open a terminap and type
PHP Code
<?php nc -v targetip > codereturns.txt
Then
PHP Code
<?php GET / HTTP / 1.1 Host: target ip
I think this is what you want? IF it's not I apologize and I'll reform my answer. Uhm, this is the vb.net section, I'm looking for how to do this in vb.net.
Nov 6, 2016 02:23 PM
(This post was last modified: Nov 6, 2016 02:25 PM by Papa Cuda.)
(Nov 6, 2016 02:20 PM)Egregious Jr. Wrote: Uhm, this is the vb.net section, I'm looking for how to do this in vb.net.
🤣 oh my god I'm sorry I wasted your time.
This may actually help
PHP Code
<?php Imports System.Threading Imports System.Net Imports System.Net.Sockets Imports System.Text Imports System.IO
Module Module1 Public ScanningThreads As Integer Sub Main() Console.WriteLine("Enter number of threads and press ENTER (50 is a good choice)") ScanningThreads = Convert.ToInt32(Console.ReadLine()) FillPortsList() Try For i As Integer = 0 To ScanningThreads Dim GrabberThread As New Thread(AddressOf GrabBannerJob) GrabberThread.Start() Next i Catch ex As Exception Console.WriteLine(ex.ToString()) Console.ReadLine() End Try End Sub
Public _rng As New Random()
Public Function rNext(ByVal min As Integer, ByVal max As Integer) As Integer Return _rng.Next(min, max) End Function
Public Function GenerateIp() As String Return rNext(11, 239) & "." & rNext(1, 255) & "." & rNext(1, 255) & "." & rNext(1, 255) End Function
Public PortsList As New List(Of Integer)()
Public Sub FillPortsList() PortsList.Add(21) PortsList.Add(22) PortsList.Add(1406) PortsList.Add(25) PortsList.Add(5900) End Sub
Public Sub SockConnect(ByVal sIpadress As String, ByVal sPort As Integer) Dim data As Byte() = New Byte(1023) {} Dim stringData As String Dim recv As Integer Dim ipep As New IPEndPoint(IPAddress.Parse(sIpadress), sPort) Dim server As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) Try server.Connect(ipep) Dim ns As New NetworkStream(server) If ns.CanRead Then recv = ns.Read(data, 0, data.Length) stringData = Encoding.ASCII.GetString(data, 0, recv) If stringData <> "" Then Console.WriteLine(sIpadress & ":" & sPort & " : " & stringData) File.AppendAllText("banners.txt", sIpadress & ":" & sPort & " : " & stringData & vbCr & vbLf) End If Else ns.Close() server.Close() End If Catch End Try
End Sub
Public Sub GrabBannerJob() While True Try Dim ipadress As String = GenerateIp() For Each lPort As Integer In PortsList Dim port As Integer = lPort SockConnect(ipadress, port) Next Catch End Try End While End Sub End Module
Earning for the year 2017:
super spooky
(Nov 6, 2016 02:23 PM)Papa Cuda Wrote: 🤣 oh my god I'm sorry I wasted your time.
This may actually help
PHP Code
<?php Imports System.Threading Imports System.Net Imports System.Net.Sockets Imports System.Text Imports System.IO
Module Module1 Public ScanningThreads As Integer Sub Main() Console.WriteLine("Enter number of threads and press ENTER (50 is a good choice)") ScanningThreads = Convert.ToInt32(Console.ReadLine()) FillPortsList() Try For i As Integer = 0 To ScanningThreads Dim GrabberThread As New Thread(AddressOf GrabBannerJob) GrabberThread.Start() Next i Catch ex As Exception Console.WriteLine(ex.ToString()) Console.ReadLine() End Try End Sub
Public _rng As New Random()
Public Function rNext(ByVal min As Integer, ByVal max As Integer) As Integer Return _rng.Next(min, max) End Function
Public Function GenerateIp() As String Return rNext(11, 239) & "." & rNext(1, 255) & "." & rNext(1, 255) & "." & rNext(1, 255) End Function
Public PortsList As New List(Of Integer)()
Public Sub FillPortsList() PortsList.Add(21) PortsList.Add(22) PortsList.Add(1406) PortsList.Add(25) PortsList.Add(5900) End Sub
Public Sub SockConnect(ByVal sIpadress As String, ByVal sPort As Integer) Dim data As Byte() = New Byte(1023) {} Dim stringData As String Dim recv As Integer Dim ipep As New IPEndPoint(IPAddress.Parse(sIpadress), sPort) Dim server As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) Try server.Connect(ipep) Dim ns As New NetworkStream(server) If ns.CanRead Then recv = ns.Read(data, 0, data.Length) stringData = Encoding.ASCII.GetString(data, 0, recv) If stringData <> "" Then Console.WriteLine(sIpadress & ":" & sPort & " : " & stringData) File.AppendAllText("banners.txt", sIpadress & ":" & sPort & " : " & stringData & vbCr & vbLf) End If Else ns.Close() server.Close() End If Catch End Try
End Sub
Public Sub GrabBannerJob() While True Try Dim ipadress As String = GenerateIp() For Each lPort As Integer In PortsList Dim port As Integer = lPort SockConnect(ipadress, port) Next Catch End Try End While End Sub End Module
Don't think that's it. No problem lol
(Nov 6, 2016 02:13 PM)Papa Cuda Wrote: Are you talking about banner grabbing, like with net cat or telnet?
(Nov 6, 2016 02:17 PM)Papa Cuda Wrote: If I'm understanding you correctly open a terminap and type
PHP Code
<?php nc -v targetip > codereturns.txt
Then
PHP Code
<?php GET / HTTP / 1.1 Host: target ip
I think this is what you want? IF it's not I apologize and I'll reform my answer.
(Nov 6, 2016 02:23 PM)Papa Cuda Wrote: 🤣 oh my god I'm sorry I wasted your time.
This may actually help
PHP Code
<?php Imports System.Threading Imports System.Net Imports System.Net.Sockets Imports System.Text Imports System.IO
Module Module1 Public ScanningThreads As Integer Sub Main() Console.WriteLine("Enter number of threads and press ENTER (50 is a good choice)") ScanningThreads = Convert.ToInt32(Console.ReadLine()) FillPortsList() Try For i As Integer = 0 To ScanningThreads Dim GrabberThread As New Thread(AddressOf GrabBannerJob) GrabberThread.Start() Next i Catch ex As Exception Console.WriteLine(ex.ToString()) Console.ReadLine() End Try End Sub
Public _rng As New Random()
Public Function rNext(ByVal min As Integer, ByVal max As Integer) As Integer Return _rng.Next(min, max) End Function
Public Function GenerateIp() As String Return rNext(11, 239) & "." & rNext(1, 255) & "." & rNext(1, 255) & "." & rNext(1, 255) End Function
Public PortsList As New List(Of Integer)()
Public Sub FillPortsList() PortsList.Add(21) PortsList.Add(22) PortsList.Add(1406) PortsList.Add(25) PortsList.Add(5900) End Sub
Public Sub SockConnect(ByVal sIpadress As String, ByVal sPort As Integer) Dim data As Byte() = New Byte(1023) {} Dim stringData As String Dim recv As Integer Dim ipep As New IPEndPoint(IPAddress.Parse(sIpadress), sPort) Dim server As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) Try server.Connect(ipep) Dim ns As New NetworkStream(server) If ns.CanRead Then recv = ns.Read(data, 0, data.Length) stringData = Encoding.ASCII.GetString(data, 0, recv) If stringData <> "" Then Console.WriteLine(sIpadress & ":" & sPort & " : " & stringData) File.AppendAllText("banners.txt", sIpadress & ":" & sPort & " : " & stringData & vbCr & vbLf) End If Else ns.Close() server.Close() End If Catch End Try
End Sub
Public Sub GrabBannerJob() While True Try Dim ipadress As String = GenerateIp() For Each lPort As Integer In PortsList Dim port As Integer = lPort SockConnect(ipadress, port) Next Catch End Try End While End Sub End Module
You deserve a -3 for shit posting, please stay out of this forum if you have no clue what you're talking about. I get the feeling you're trolling too.
@Op What library are you using to create the Http connection? WebClient, HttpWebRequest or HttpClient?
(Nov 6, 2016 04:20 PM)+Haze Wrote: You deserve a -3 for shit posting, please stay out of this forum if you have no clue what you're talking about. I get the feeling you're trolling too.
@Op What library are you using to create the Http connection? WebClient, HttpWebRequest or HttpClient? I believe HttpWebRequest.
I have 0 knowledge of vb.net but google is a very powerful tool
http://stackoverflow.com/questions/69234...ode-400-ba
Looks like you need to catch an exception from WebException then just
HttpWebResponse httpResponse = (HttpWebResponse) response;
httpResponse.StatusCode <- will be your HTTP response code
Hope I was of at least some assistance.
(Nov 6, 2016 04:29 PM)Diaxin Wrote: I have 0 knowledge of vb.net but google is a very powerful tool
http://stackoverflow.com/questions/69234...ode-400-ba
Looks like you need to catch an exception from WebException then just
HttpWebResponse httpResponse = (HttpWebResponse) response;
httpResponse.StatusCode <- will be your HTTP response code
Hope I was of at least some assistance. Thanks. I'll look into that.
(Nov 6, 2016 02:07 PM)Egregious Jr. Wrote: How can I make GET request to the API and then save the HTTP status code?
The HttpWebResponse has a property called StatusCode.
For the glory of humanity
Thanks guys, I will take a look at those.
DO NOT DEAL WITH THIS MEMBER
|