I'm moving away from browser bots, I need suggestions.

Which language for writing bots in little time?

  • C#

    Votes: 0 0.0%
  • Java

    Votes: 0 0.0%
  • PHP

    Votes: 0 0.0%

  • Total voters
    0

xpro

Regular Member
Joined
Jan 21, 2009
Messages
442
Reaction score
24
Hello

I used to write all my bots witch worked with the browser, but they are unreliable and slow. I've been trying to move away from it, but I'm having a hard time finding something that I can use to write my bots in little time. My main concern is the time it takes to write bots and I want the code to be pretty small. Which language would be the best for that?


Best Regards
 
I would say python
why?

java code

class fknjava
public static void main
{
System.out.println("Hello Fucker!@")
}

In python
print ("Hello Fucker")
 
I would say python
why?

java code

class fknjava
public static void main
{
System.out.println("Hello Fucker!@")
}

In python
print ("Hello Fucker")

I made a yahoo mail auto responder using browser bots, would the same thing be possible with out using a browser? Would it take a lot more coding?
 
I guess it depends on what you want to automate exactly, I would definitely say Python also, as it's relatively easy to learn, and you don't have to write tons and tons of code.
 
i recommend either vb.net of c#

.net is a well documented and supported rapid development platform mounted on solid oop and a robust framework.

search for some of my other posts about this subject. i have put out a lot of information on .net
 
In .NET, take a look at WebClient class.

In PHP, use CURL.
 
Thanks for all the suggestions guys. I've chosen C# to write my bots in. I will start writing a bot tonight which requires logging in and sending PMs.
 
may i suggest this HTTP library for use with C# (supports most languages)
Code:
http://www.chilkatsoft.com/HttpDotNet.asp
you can easily find the cracked version

Example Code:
Code:
http://www.example-code.com/csharp/http.asp

GL :)
 
ok guys, so I've started writing the bot for mocospace and I'm using httpfox to see the requests/responses.

I checked the post string and it looks like this

"action=login&login_name=Anastasiahiggins&password=a12345678&user_key=-1763759965"

what caught my eye was "user_key=-1763759965" and than I checked the login page and found it was a randomly generated number which got passed in the POST string. What is the best way to extract stuff from source in C#? I would need to extract that and send it with the POST string.

Best Regards!
 
I would use PHP for extracting POSTs. you can extra items from a url really easily with PHP
 
I would use PHP for extracting POSTs. you can extra items from a url really easily with PHP

I'm trying yo parse the html generated from the login page. What is the best way to do it using c#?
 
I'm trying yo parse the html generated from the login page. What is the best way to do it using c#?


regex is a damn fine solution as w84it said. i'm not that strong with regex, so i usually use the string parsing in the framework. it's more brittle but it's a comfortable technique for me. if you're good with regex though i encourage you to go that route.

i don't have a c# version of this function handy, but this should give you a basic idea.

Code:
   Public Function Parse(ByVal origionalData As String, ByVal prefix As String, ByVal suffix As String) As String
        Dim returnData As String = ""
        Dim preLoc As Integer = InStr(origionalData, prefix)

        If preLoc > 0 Then
            Dim tempBuffer As String = Mid(origionalData, preLoc + prefix.Length)
            Dim suffLoc As Integer = InStr(tempBuffer, suffix)
            If suffLoc > 0 Then
                returnData = Mid(tempBuffer, 1, suffLoc - 1)
            End If
        End If

        Return returnData
    End Function
also, take a look at the string class on msdn. that spells out all the methods you can use for string manipulation.

Code:
http://msdn.microsoft.com/en-us/library/system.string.aspx
 
The language is irrelevant, just use what you are most comfortable with... I started off with VBscript but quickly got tired of it being hard to find documentation and now I use PHP... I still haven't grasped building bots outside of the browser (i still use imacros) because I don't know enough about packet sniffing / re-assembly, etc .. but I am sure it doesn't matter since any language has a method for doing web calls (like curl in PHP).. the main thing is to be comfortable with using a database with your programming language (like mysql) since you need to use this effectively to build efficient bots / apps
 
As far as extracting URLs, look into Grep programs (they have some for windows and also in linux), you can program using Grep, such as in PHP, but its time consuming to get started with it if you aren't used to it, so right now I just do a manual grep on a huge file that I compile from my php script... but basically you just want to get each url line separated and then put it into a mysql database... then in mysql its really use to use the "like" function (google it) to retrieve strings that from a database column that match something so like if you're just doing email confirmations or something you can just use this to match a specific username,etc
 
I found this program which helps to create regexes in a faster and more reliable way. here you go guys

HTML:
http://www.ultrapico.com/Expresso.htm
 
I wrote some code, but I keep getting runtime errors when trying to post data. Here is what I have so far.


Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string key = "";
            ASCIIEncoding encoding = new ASCIIEncoding();
            CookieContainer cookieContainer = new CookieContainer();


            HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.mocospace.com/html/login.jsp");
            request.CookieContainer = cookieContainer;
            request.ContentType = "application/x-www-form-urlencoded";
            request.UserAgent = "Mozilla/4.0(PC) (compatible; MSIE 8.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)";

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            StreamReader stream = new StreamReader(response.GetResponseStream(), System.Text.Encoding.ASCII);
            String result = stream.ReadToEnd();

            response.Close();

            // Here we call Regex.Match.
            Match match = Regex.Match(result, "<input type=\"hidden\" name=\"user_key\" value=\"(.*)\"/>", RegexOptions.IgnoreCase);

            // Here we check the Match instance.
            if (match.Success)
            {
                key = match.Groups[1].Value;
                Console.WriteLine(key);
            }

            String loginData = "action=login&login_name=Anastasiahiggins&password=a12345678&user_key=" + key;
            byte[] data = encoding.GetBytes(loginData);
            Console.WriteLine(loginData);

            try
            {
                request.Method = "POST";
                request.ContentType = "application/x-www-form-urlencoded";
                request.ContentLength = data.Length;

                Stream newStream = request.GetRequestStream();
                newStream.Write(data, 0, data.Length);
                newStream.Close();
            }
            catch(Exception e){
                Console.WriteLine(e);
            }
            


            TextWriter tw = new StreamWriter("result.html");
            tw.WriteLine(result);
            tw.Close();

            response.Close();
            stream.Close();
        }
    }
}


It works up to the point I extract the user_key, but I tried to make the POST work but I kept getting runtime errors. Can anyone see what I'm doing wrong?


Best Regards!
 
I think you can use python for its easy and short coding:loser:
 
Back
Top