Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Text.RegularExpressions
Public Class Form1
Dim loginCoockie As New CookieContainer
Dim thread As System.Threading.Thread
Public Sub PostTopic()
Dim yGroups As String = txtGroup.Text
Dim TopicSubject As String = txtSubject.Text
Dim TopicBody As String = RichTextBox1.Text
Try
Dim postTopic As String = "referer=%2Fgroup%2F" & yGroups & "%2F&messageNum=0&ycb=nu3Ar2AKlrH&send=Send&from=&subject=" & TopicSubject & "&message=" & TopicBody & "&lang=00"
Dim tempCookies As New CookieContainer
Dim encoding As New UTF8Encoding
Dim byteData As Byte() = encoding.GetBytes(postTopic)
Dim postRequest As HttpWebRequest = DirectCast(WebRequest.Create("http://groups.yahoo.com/group/post" & yGroups & "z/post"), HttpWebRequest)
postRequest.Method = "POST"
postRequest.KeepAlive = True
postRequest.CookieContainer = tempCookies
postRequest.ContentType = "application/x-www-form-urlencoded"
postRequest.Referer = "http://groups.yahoo.com/group/post" & yGroups & "/post"
postRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0a2) Gecko/20110613 Firefox/6.0a2"
postRequest.ContentLength = byteData.Length
Dim postReqStream As Stream = postRequest.GetRequestStream
postReqStream.Write(byteData, 0, byteData.Length)
postReqStream.Close()
Dim postResponse As HttpWebResponse
postResponse = DirectCast(postRequest.GetResponse(), HttpWebResponse)
tempCookies.Add(postResponse.Cookies)
loginCoockie = tempCookies
Dim postReqReader As New StreamReader(postResponse.GetResponseStream())
Dim thepage As String = postReqReader.ReadToEnd
RichTextBox1.Text = thepage
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Public Sub PostThread()
lblStatus.Text = "Trying to login"
Dim uName As String = TextBox1.Text
Dim pWord As String = TextBox2.Text
Try
Dim postData As String = ".tries=1&.src=ym&.md5=&.hash=&.js=&.last=&promo=&.intl=us&.bypass=&.partner=&.u=7jebrpt78q79h&.v=0& .challenge=a5PSc8KUgQ7.sU0VVUE9JsdHOosB&.yplus=&.emailCode=&pkg=&stepid=&.ev=&hasMsgr=0&.chkP=Y&.don e=http%3A%2F%2Fmail.yahoo.com&.pd=ym_ver%3D0%26c%3D%26ivt%3D%26sg%3D&.ws=1&.cp=0&pad=5&aad=6&login=" & uName & "&passwd=" & pWord & "&.save=&passwd_raw="
Dim tempCookies As New CookieContainer
Dim encoding As New UTF8Encoding
Dim byteData As Byte() = encoding.GetBytes(postData)
Dim postRequest As HttpWebRequest = DirectCast(WebRequest.Create("https://login.yahoo.com/config/login"), HttpWebRequest)
postRequest.Method = "POST"
postRequest.KeepAlive = True
postRequest.CookieContainer = tempCookies
postRequest.ContentType = "application/x-www-form-urlencoded"
postRequest.Referer = "https://login.yahoo.com/config/login"
postRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0a2) Gecko/20110613 Firefox/6.0a2"
postRequest.ContentLength = byteData.Length
Dim postReqStream As Stream = postRequest.GetRequestStream
postReqStream.Write(byteData, 0, byteData.Length)
postReqStream.Close()
Dim postResponse As HttpWebResponse
postResponse = DirectCast(postRequest.GetResponse(), HttpWebResponse)
tempCookies.Add(postResponse.Cookies)
loginCoockie = tempCookies
Dim postReqReader As New StreamReader(postResponse.GetResponseStream())
Dim thepage As String = postReqReader.ReadToEnd
If thepage.Contains(Chr(34) & "status" & Chr(34) & " : " & Chr(34) & "error" & Chr(34)) = True Then
lblStatus.Text = "Login Failed"
Exit Sub
Else
lblStatus.Text = "Login success"
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
thread = New System.Threading.Thread(AddressOf PostThread)
thread.Start()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Control.CheckForIllegalCrossThreadCalls = False
End Sub
End Class