Sign in to follow this  
Followers 0
spyrorocks

PHPBB Forum Bot

10 posts in this topic

OK, after some time of work, here is my PHPBB forum bot. the code is a bit messy though. It is some basic frameowrk of a bot that can post on phpbb forums, any message you like. It could be modefyed to have some sort of AI so you could to some extent make it interact with the users...

#include <Array.au3>
#include<IE.au3>
#include <GUIConstants.au3>
$Form1 = GUICreate("PHPBB Bot by Spyrorocks", 467, 249, 192, 125)
GUICtrlCreateLabel("Root url to forum: ", 8, 8, 88, 17)
$text_root = GUICtrlCreateInput("http://spyrorocks.hopto.org:8081/testingforum/", 96, 8, 361, 21, -1, $WS_EX_CLIENTEDGE)
$ceck_newtopics = GUICtrlCreateCheckbox("Make New topics?", 8, 48, 121, 17)
GUICtrlCreateLabel("Message to post: ", 8, 88, 88, 17)
$text_msg = GUICtrlCreateEdit("", 96, 88, 321, 121, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateLabel("Subject:", 128, 48, 43, 17)
$text_subject = GUICtrlCreateInput("Hello", 168, 48, 217, 21, -1, $WS_EX_CLIENTEDGE)
$Button1 = GUICtrlCreateButton("Start", 184, 224, 75, 25)
GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $Button1
        Case Else
            ;;;;;;;
    EndSelect
    If $msg = $Button1 Then startit()
WEnd
Exit
Func startit()
    If GUICtrlRead($ceck_newtopics) = $GUI_CHECKED Then
        $newtopics = 1
    Else
        $newtopics = 0
    EndIf
    $root = GUICtrlRead($text_root)
    $oIE = _iecreate ($root & "index.php")
    $subject = GUICtrlRead($text_subject)
    $msg = GUICtrlRead($text_msg)
    $source = _IEDocReadHTML ($oIE)
    $source = StringSplit($source, @CRLF)
    $ids = _ArrayCreate('')
    For $i = 1 To $source[0]
        $str = StringSplit($source[$i], "viewforum.php?f=", 1)
        If IsArray($str) And $str[1] <> $source[$i] Then
            $str = StringSplit($str[2], '"', 1)
            If IsArray($str) And StringIsDigit($str[1]) Then
                _ArrayAdd($ids, $str[1])
            EndIf
        EndIf
    Next
    While 1
        $id = Random(_ArrayMin($ids, 1), _ArrayMax($ids, 1), 1)
        ;$id = 1
        If Not $id = 0 Then
            _IENavigate ($oIE, $root & "viewforum.php?f=" & $id)
            If $newtopics And Random(1, 5, 1) = 3 Then
                _IEImgClick ($oIE, "Post new topic", "alt")
                $oform = _IEFormGetCollection ($oIE, 0)
                $omsg = _IEFormElementGetObjByName ($oform, "subject")
                _IEFormElementSetValue ($omsg, $subject)
                $omsg = _IEFormElementGetObjByName ($oform, "message")
                _IEFormElementSetValue ($omsg, $msg)
                $oSubmit = _IEGetObjByName ($oIE, "post", 1)
                _IEAction ($oSubmit, "click")
                _IELoadWait ($oIE)
            Else
                $source = _IEDocReadHTML ($oIE)
                $source = StringSplit($source, @CRLF)
                $tids = _ArrayCreate('')
                For $i = 1 To $source[0]
                    $str = StringSplit($source[$i], "viewtopic.php?t=", 1)
                    If IsArray($str) And $str[1] <> $source[$i] Then
                        $str = StringSplit($str[2], '"', 1)
                        If IsArray($str) And StringIsDigit($str[1]) Then
                            _ArrayAdd($tids, $str[1])
                        EndIf
                    EndIf
                Next
                $topicid = Random(_ArrayMin($tids, 1), _ArrayMax($tids, 1), 1)
                If Not $topicid = 0 Then
                    _IENavigate ($oIE, $root & "viewtopic.php?t=" & $topicid)
                    _IEImgClick ($oIE, "Reply to topic", "alt")
                    $oform = _IEFormGetCollection ($oIE, 0)
                    $omsg = _IEFormElementGetObjByName ($oform, "message")
                    _IEFormElementSetValue ($omsg, $msg)
                    $oSubmit = _IEGetObjByName ($oIE, "post", 1)
                    _IEAction ($oSubmit, "click")
                    _IELoadWait ($oIE)
                    $source = _IEDocReadHTML ($oIE)
                    If StringInStr($source, "You cannot make another post so soon after your last; please try again in a short while.") Then
                        Sleep(15000)
                    EndIf
                EndIf
            EndIf
        EndIf
    WEnd
EndFunc   ;==>startit

Any comments?

Share this post


Link to post
Share on other sites



OK, after some time of work, here is my PHPBB forum bot. the code is a bit messy though. It is some basic frameowrk of a bot that can post on phpbb forums, any message you like. It could be modefyed to have some sort of AI so you could to some extent make it interact with the users...

Any comments?

Maybe an obvious question/comment... Could you explain what exactly someone would use this for?

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Comment: Your test forum is allready down. Probably because people are spamming it like hell by now. Hope you really like it. :ph34r:

I ceartanly would not like it if I was the addmin of a PHPBB forum :lmao:

Share this post


Link to post
Share on other sites

Why?

I think we are all still waiting to see what "useful" purpose you had in mind when you made this. You say ChatBox() I don't see where it reads "chat" and I don't see any AI to communicate to that chat, so what else was on your mind?

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

I said that this is basic frameowrk for a phpbb chatbot. you could inplant some sort of a way to read the last users username and make a comment upon what words are found in the last message.

Share this post


Link to post
Share on other sites

Would be cool if you made a program to read through the elements of a page and extract info like posts, usernames, ect.. Then display it in some kind of custom fashon.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0