Login Register






Using the Pastebin API filter_list
Author
Message
Using the Pastebin API #1
Using the Pastebin API

Documentation
The API documentation is available at http://pastebin.com/api
You have to sign in to your Pastebin account and copy your developer API key. It should look something like this:
Code:
bea653b8925cc505ff2*************

Usages
Pastebin has much potential in a big variety of applications. It could be used to capture data from infected bots and send back a nice link to the hacker.

Example Class
I threw together a Pastebin class with help of the documentation and Microsoft HTTP Post example. The URLEncode method is from FreeVBCode.com. It works perfectly but you'd have to enter your own API key.
Code:
Public Class Pastebin Public Function NewPaste(ByVal Content As String) Dim api_dev_key As String = "" '<-- Your API key here Dim api_paste_code As String = URLEncode(Content) Dim api_paste_private As String = "2" 'Dim api_paste_name As String = URLEncode(Name) Dim api_paste_expire_date As String = "10M" Dim api_paste_format As String = "php" Dim api_user_key As String = "" Dim Response As String = HttpPost("http://pastebin.com/api/api_post.php", "api_option=paste&api_dev_key=" & api_dev_key & "&api_paste_code=" & api_paste_code) If Response.Contains("Bad API request") = False Then Return Raw(Response) Else Return "Error" End If End Function Private Function URLEncode(ByVal EncodeStr As String) As String Dim i As Integer Dim erg As String erg = EncodeStr erg = Replace(erg, "%", Chr(1)) erg = Replace(erg, "+", Chr(2)) For i = 0 To 255 Select Case i Case 37, 43, 48 To 57, 65 To 90, 97 To 122 Case 1 erg = Replace(erg, Chr(i), "%25") Case 2 erg = Replace(erg, Chr(i), "%2B") Case 32 erg = Replace(erg, Chr(i), "+") Case 3 To 15 erg = Replace(erg, Chr(i), "%0" & Hex(i)) Case Else erg = Replace(erg, Chr(i), "%" & Hex(i)) End Select Next Return erg End Function Public Function Raw(ByVal URL As String) Dim ID As String = URL.Substring(URL.LastIndexOf("/") + 1) ID = "http://pastebin.com/raw.php?i=" & ID Return ID End Function Private Function HttpPost(ByVal URL As String, ByVal Data As String) Dim request As WebRequest = WebRequest.Create(URL) request.Method = "POST" Dim byteArray As Byte() = Encoding.UTF8.GetBytes(Data) request.ContentType = "application/x-www-form-urlencoded" request.ContentLength = byteArray.Length Dim dataStream As Stream = request.GetRequestStream() dataStream.Write(byteArray, 0, byteArray.Length) dataStream.Close() Dim response As WebResponse = request.GetResponse() 'Console.WriteLine(CType(response, HttpWebResponse).StatusDescription) dataStream = response.GetResponseStream() Dim reader As New StreamReader(dataStream) Dim responseFromServer As String = reader.ReadToEnd() reader.Close() dataStream.Close() response.Close() Return responseFromServer End Function End Class

Example usage:
Code:
Dim P As New Pastebin : My.Computer.Clipboard.SetText(P.NewPaste("Hello world!")) MsgBox("Posted!")

Reply

RE: Using the Pastebin API #2
Nice for VB users. Doesn't look hard to convert to C# either.
[Image: BAvhP6h.png]
Code:
[5:42:25 PM] i0xillusi0n: Breshie don't bust a nut over chloe now [5:42:31 PM] Entity: fapfapfapfapfapfapfapfapfapfap [5:42:33 PM] Jigglypuff | SL: EWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW

Reply