View Full Version : Create Your First BOT
SyntaXmasteR
08-20-2007, 05:54 PM
Create Your First BOT
This will be a very, very basic tutorial on what a bot is and how to create one. First you need to understand that a "BOT" is only a series of programming commands/functions that do "SOMETHING".
In this example my bot will: GRAB ALL USERNAMES FROM ALL-NETTOOLS.COM
First we need to find out how all-nettools.com displays usernames so first we need to click on "Member List (http://www.all-nettools.com/forum/memberlist.php)".
Notice the URL structure of each user profile: http://www.all-nettools.com/forum/member.php?u=657*
With a little digging you will find that the first user (OTTO - administrator) is
http://www.all-nettools.com/forum/member.php?u=*
We can now get started writing our bot. You need to make a step by step list of what you want the bot to do.
*. Check to see if URL exists
2. Grab HTML from URL
*. Find username starting point in html
4. Find username ending point in html
5. Grab next URL
PHP CODE
function bot_allnettools($user){
// CHECK TO SEE IF URL EXISTS
if($current_webpage=file_get_contents("http://www.all-nettools.com/forum/member.php?u=" . $user)){
$user_identifier_beginning="<div class=\"bigusername\">";
$user_identifier_end="<img";
// CHECKS FOR MATCHING PATTERN WITH BEGINNING AND ENDING IDENTIFIERS (NOTICE THE WILDCARD IN THE MIDDLE)
if (preg_match('/' . $user_identifier_beginning . '(.*?)' . $user_identifier_end . '/',$current_webpage,$match)) {
$match[0]=str_replace($user_identifier_beginning,"",$match[0]);
$match[0]=str_replace($user_identifier_end,"",$match[0]);
return($match[0]);
}
}
return(0);
}
I am not posting my live example because it uses a lot of the bandwidth allocated to all-nettools.com. This was only an example so please do not use this information to create bots on all-nettools.com or you will be permanently banned and reported to your ISP.
~SyntaX
Moonbat
08-20-2007, 07:37 PM
I think something like this is possible using cURL with less code, but I'd have to whip up something to see if it can be smaller than that, and not all web hosts (at least not all free ones) support cURL.
But nevertheless, that's a nice tut:D
SyntaXmasteR
08-20-2007, 08:21 PM
Hey Moonbat, let me know if you know of any easier ways of doing this. I was trying to find a php command for find and replace (BUT ONLY ONCE). I could not find this anywhere. If you know of a command please let me know. The reason I need this:
HTML
This is my code I will place a link here <a href="BLAH.com">This is the first link</a>I do not need this link. I would like to get to the starting point of this link but I cant if they contain the same code <a href="BLAH.com">This is the first link</a>.
My idea behind finding the starting point of the second <a href tag is to do a find and replace on the first one to change it to (WHATEVER). Then do a strpos() function on the html that will grab the second starting point. How do you do a find and replace, only once. Does this function exist?
Thanks to whomever can answer this, it will greatly help out!
~SyntaX
__Dave__
08-20-2007, 09:33 PM
nice.. this might come in handy for one of my sites sometimes =)
thanks for sharing bro
SyntaXmasteR
08-21-2007, 07:14 PM
I'm horrible at regular expressions but I updated the code with a cleaner version than the one I posted earlier using.
Moonbat
08-21-2007, 07:50 PM
Oh yeah, that looks much better :cool:
Ezekiel
08-22-2007, 11:44 AM
Steps * and 4 would be much easier to accomplish with Javascript using the HTML DOM, but you need the server-side scripting for such actions as writing the username list to file, and of course when putting these scripts on an external server (not on all-nettools.com domain), you can't use any AJAX skills to retrieve pages and traverse the DOM.
Maybe you could use this to simplify the parsing:
http://php.net/domxml
I doubt this site's code is valid enough to be treated as XML though.
By the way, you should revert to writing opening/closing braces the way you used to (as said in other thread):
if($lol)
{
$lulz = *;
}
else
{
$lulz = 0;
}
Support the style you know is right!
SyntaXmasteR
08-22-2007, 01:12 PM
Mike
Throw your best XML, DOM, AJAX, & JAVASCRIPT tutorials at me. I need a strong starting point, that gives great examples for each new application that it teaches.
I've overloaded myself on PHP, MYSQL, & serious data validation. Data validation has taken a while. I'm ready to move on to new Web 2.0 stuff, but I like to learn the absolute correct way & not the "hack the code to make it work" way.
What order should I learn them in? Javascript, XML, DOM, AJAX ?
Ezekiel
08-22-2007, 07:02 PM
I'm up to my neck in priorities right now, so unfortunately I can't provide any tuts on the subject.
I'm no expert; w*schools.com taught me most of what I know, and the rest was trial, error and improvement. Probably not the correct way, and I'd say I'm a Javascript noob.
The best thing I've made in Javascript was the real-time forum topics update box for my site, but I couldn't be bothered to apply the Web 2.0 crap to my whole site so I reverted to pulling it from the database on each request. I think I deleted the whole code for that.
If you look on my site, the containers can be minimised and maximised. Pointless, but here's the code:
function minimizeContainer(containerTopId, containerHeaderId, containerContentId, containerFooterId)
{
if(document.getElementById(containerTopId) && document.getElementById(containerContentId) && document.getElementById(containerHeaderId) && document.getElementById(containerFooterId))
{
document.getElementById(containerContentId).style.display = "none";
document.getElementById(containerFooterId).style.display = "none";
document.getElementById(containerHeaderId).style.marginBottom = "*em";
return *;
}
else
{
return 0;
}
}
function maximizeContainer(containerTopId, containerHeaderId, containerContentId, containerFooterId)
{
if(document.getElementById(containerTopId) && document.getElementById(containerContentId) && document.getElementById(containerHeaderId) && document.getElementById(containerFooterId))
{
document.getElementById(containerContentId).style.display = "block";
document.getElementById(containerFooterId).style.display = "block";
document.getElementById(containerHeaderId).style.marginBottom = "0";
return *;
}
else
{
return 0;
}
}
function closeContainer(containerTopId, containerHeaderId, containerContentId, containerFooterId)
{
if(document.getElementById(containerTopId) && document.getElementById(containerContentId) && document.getElementById(containerHeaderId) && document.getElementById(containerFooterId))
{
document.getElementById(containerTopId).style.display = "none";
document.getElementById(containerHeaderId).style.display = "none";
document.getElementById(containerContentId).style.display = "none";
document.getElementById(containerFooterId).style.display = "none";
return *;
}
else
{
return 0;
}
}
Creating the Digg links, etc.:
function createNavigationBarLink(listItemClass, linkHref, linkClass, imageSource, imageWidth, imageHeight, imageAlt)
{
if(listItemClass && linkHref && linkClass && imageSource && imageWidth && imageHeight && imageAlt)
{
var nameSpace = "http://www.w*.org/****/xhtml";
var listItem = document.createElementNS(nameSpace, "li");
listItem.setAttribute("class", listItemClass);
document.getElementById("navigation_bar").getElementsByTagName("ul")[0].appendChild(listItem);
var link = document.createElementNS(nameSpace, "a");
link.setAttribute("href", linkHref);
link.setAttribute("class", linkClass);
if(!listItem.appendChild(link))
{
return 0;
}
var image = document.createElementNS(nameSpace, "img");
image.setAttribute("src", imageSource);
image.setAttribute("width", imageWidth);
image.setAttribute("height", imageHeight);
image.setAttribute("alt", imageAlt);
if(!link.appendChild(image))
{
return 0;
}
return *;
}
else
{
return 0;
}
}
I mostly learn as I go along.
For this, I was implying that you use an XMLHTTP request to load the member page's DOM tree, then find the part you want and pull data from that node. All these sorts of dynamic browser requests are limited to the current domain, so syntax******.info couldn't get its users' browsers to pull the page from all-nettools.com. If it was on all-nettools, the info could be sorted with JS in the user's browser.
I can't type coherently again, so I'm probably making mistakes.
What order should I learn them in? Javascript, XML, DOM, AJAX ?
First make sure you know HTML well enough, then learn about XML documents and XHTML so you can make your sites all valid XHTML or even XML. Then, you can use Javascript to work with the DOM, which is basically the structure of a web page. Each element (such as <div></div>) is a node, and you can move up and down the tree. You can manipulate data in nodes; their attributes, etc.
AJAX is just a web 2.0 term to describe the way that pages can be dynamic. Javascript can be used to request XML from a server without a whole page re*****, then the XML can be parsed for whatever reason.
Teh Pro
08-28-2007, 03:15 AM
nice tutorial =)
Enigma12
08-28-2007, 07:56 AM
i think i may have found what im looking for as i have posted here asking where and now to learn hacking i think this will be more interesting to learn all that code just look far to intriguing just to leave alone and not fined out what it does exactly and why
ps. SyntaX****** listened to your advice when i singed up to your web page and now trying to fined out about HTML as a language
only thing is when on your site none of the tabs work and only get one page telling me about your site would like help please getting to more content
SyntaXmasteR
08-28-2007, 09:52 AM
I'm building my site component by component. Its very complicated (at least to me) because I am writing the code using a flag system I created. It has three security levels.
Level *: User based flags
Level 2: IP based flags
Level *: Sitewide flags
A flag is thrown when a user inputs bad data or executes unnatural POST or GET requests. The user will be blocked after (X) ammounts of flags in (X) ammount of time. The IP will be blocked after (X) ammounts of flags in (X) ammount of time. Finally the site will put itself into a safemode after (X) ammounts of flags in (X) ammount of time.
Keep checking back soon, things will fill out.
~SyntaX
HeX CoDeR
08-29-2007, 08:00 PM
lol descent tut. But u should really explain the rest lol. theres other methods of doing this n there are alot of bots to be made. for example a myspace bot made just for myspace. lol still a nice tut. im not trying to degrade anyone but u really should post up the tut on other bots not just the basics. unless theres a topic i missed.
Ezekiel
08-29-2007, 08:19 PM
for example a myspace bot made just for myspace.
Good luck writing a program to parse Myspace's code as valid HTML.
SyntaXmasteR
08-29-2007, 08:20 PM
unless theres a topic i missed.
Try reading the title of this topic. Creating your first bot. Why would I include *00,000 different bot types for every possible scenario for a simple bot explanation.
HeX CoDeR
08-29-2007, 08:24 PM
lol i dont mean tht i mean u could have put up some other bots not all but more one bot is nothing u should know tht. it takes about 20 mins. for me to get the pw to ppls accounts and i am not super good but im descent with bots. and one bot like i said before doesnt do anything u could have at least posted three bots up. but hey its ur site not mine. off topic whos the admin on the site?
Ezekiel
08-29-2007, 08:32 PM
off topic whos the admin on the site?
This has remained a mystery ever since I joined in '05. There's a user called 'Admin', but I believe he is a sock-puppet for one of the big guys behind this whole thing.
D. Parker is an admin, but he seems to have to answer to people higher up than him.
Their true identity may never be known.
SyntaXmasteR
08-29-2007, 10:34 PM
it takes about 20 mins. for me to get the pw to ppls accounts
You are full of shit, and I define shit as the dead animal corpses that moonbat obsesses over. You have never written any code, hacked any accounts, created any bots, or posted any useful information on this forum. If you have, great share "your" work.
Moonbat
08-30-2007, 08:15 AM
By 'bot', I think HexCoder may mean like a botnet or something, but I don't know.
EDIT: HexCoder, if you are talking about botnets, then seriously GTFO, bot kiddies deserve to have their fingers cut off and their eyes torn out.
But if your not talking about botnets, then, well, what are you talking about? :)
HeX CoDeR
09-01-2007, 09:49 AM
whn we get the bugs out if u dnt leech the shit then i will send u the program. if u dont trust me yet i understand. im not huge in the bot world but my friend NEO_2_REMEMBER is really into tht stuff.
Moonbat
09-01-2007, 10:08 AM
So this program you speak of isn't a botnet?
Well, how exactly does it work? Also, some source code will be nice.
Ezekiel
09-01-2007, 11:57 AM
but my friend NEO_2_REMEMBER is really into tht stuff.
Him and his community are the epitome of lame.
Lifetibia
04-20-2008, 06:11 PM
uppppp :D First Topic
Powered by vBulletin® Version 4.1.8 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.