jhylands

LIRA 1.0.1

Jan 23rd, 2012
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.39 KB | None | 0 0
  1. Module Module1
  2.  
  3.     Sub Main()
  4.         Dim user As String
  5.         Dim bot As String
  6.         Do
  7.             user = Console.ReadLine()
  8.             If botresponse(bot) = "" And InStr(bot, "<html") = 0 Then
  9.                 Console.WriteLine("|" & bot & "|" & user & "|")
  10.                 bot = PostHTTPWebrequest("http://78.47.186.254/simple.php", "entry=" & bot & "&exit=" & user)
  11.             End If
  12.             Do Until bot <> "" Or user = ""
  13.                 bot = botresponse(user)
  14.                 user = Mid(user, 1, Len(user) - 1)
  15.             Loop
  16.             If bot = "" Then
  17.                 Console.WriteLine("I don't know")
  18.             ElseIf InStr(bot, "today is") Then
  19.                 Console.WriteLine("It's " & Day(Now) & " of " & MonthName(Month(Now)) & " today.")
  20.             Else
  21.  
  22.                 Console.WriteLine(bot)
  23.             End If
  24.             bot = ""
  25.         Loop
  26.  
  27.     End Sub
  28.     Public Function PostHTTPWebrequest(ByVal URL As String, ByVal PostData As String) As String
  29.         Dim encoding As New System.Text.UTF8Encoding
  30.         Dim byteData As Byte() = encoding.GetBytes(postdata)
  31.         Dim request As System.Net.HttpWebRequest
  32.         request = DirectCast(Net.HttpWebRequest.Create(URL), Net.HttpWebRequest)
  33.         request.Method = "POST"
  34.         request.ContentType = "application/x-www-form-urlencoded"
  35.         request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
  36.         request.ContentLength = byteData.Length
  37.         Dim postreqstream As System.IO.Stream = request.GetRequestStream()
  38.         postreqstream.Write(byteData, 0, byteData.Length)
  39.         postreqstream.Close()
  40.         Dim response As System.Net.HttpWebResponse
  41.         response = DirectCast(request.GetResponse(), Net.HttpWebResponse)
  42.         Dim postreqreader As New System.IO.StreamReader(response.GetResponseStream())
  43.         PostHTTPWebrequest = postreqreader.ReadToEnd
  44.     End Function
  45.     Public Function botresponse(ByVal user As String) As String
  46.         Dim bot As String
  47.         bot = PostHTTPWebrequest("http://78.47.186.254/simpleq.php", "hi=" & user)
  48.         bot = Mid(bot, (InStr(bot, ">")) + 1)
  49.         Do Until Mid(bot, 1, 1) <> Chr(13) And Mid(bot, 1, 1) <> Chr(10)
  50.             bot = Mid(bot, 2)
  51.         Loop
  52.         bot = Mid(bot, 1, InStr(bot, "<") - 1)
  53.         botresponse = bot
  54.     End Function
  55. End Module
Advertisement
Add Comment
Please, Sign In to add comment