Jump to content

Random url to script.


 Share

Recommended Posts

Learn:

 

_FileReadToArray

https://www.autoitscript.com/autoit3/docs/libfunctions/_FileReadToArray.htm

 

Random

https://www.autoitscript.com/autoit3/docs/functions/Random.htm

 

UBound

https://www.autoitscript.com/autoit3/docs/functions/UBound.htm

 

Then read over this.

 

Global $Referrer
Local $ReferrerFile = "Referrer.txt"
Local $ReferrerExists = FileExists($ReferrerFile)
If $ReferrerExists Then
    _FileReadToArray($ReferrerFile, $Referrer, 0, "")
Else
    MsgBox(0, "Referrer - Setup Error", "The file Referrer.txt doesn't exist.")
    Exit
EndIf
If UBound($Referrer) = 0 Then
    MsgBox(0, "Referrer - Setup Error", "The file Referrer.txt is empty.")
    Exit
EndIf

Local $oIE = _IECreateEmbedded()

Local $hoIE = GUICtrlCreateObj($oIE, 8, 8, 500, 500)

$oIE.Navigate2("https://www.whatismyreferer.com/", Default, Default, Default, 'User-Agent: CustomBrowser' & @CRLF & 'Referer: ' & $Referrer[Random(0, UBound($Referrer) - 1, 1)])

GUICtrlDelete($hoIE)

 

Everything you need is in that code.

 

Read it understand it and reuse it.

 

 

 

Link to comment
Share on other sites

So I have read up on them and will need to put them into practice.

I added the #includes and believe I  am right in doing so.

but still getting an error.

#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>
#include <IE.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>

Global $Referrer
Local $ReferrerFile = "referrer.txt"
Local $ReferrerExists = FileExists($ReferrerFile)
If $ReferrerExists Then
    _FileReadToArray($ReferrerFile, $Referrer, 0, "")
Else
    MsgBox(0, "Referrer - Setup Error", "The file referrer.txt doesn't exist.")
    Exit
EndIf
If UBound($Referrer) = 0 Then
    MsgBox(0, "Referrer - Setup Error", "The file referrer.txt is empty.")
    Exit
EndIf

Local $oIE = _IECreateEmbedded()
Local $hoIE = GUICtrlCreateObj($oIE, 8, 8, 500, 500)

$oIE.Navigate2("https://www.whatismyreferer.com/", Default, Default, Default, 'User-Agent: CustomBrowser' & @CRLF & 'Referer: ' & $Referrer[Random(0, UBound($Referrer) - 1, 1)])

GUICtrlDelete($hoIE)

$oIE.Navigate("https://www.whatismyreferer.com/", Default, Default, Default, 'User-Agent: CustomBrowser' & @CRLF & 'Referer: ' & $Referrer[Random(0, UBound($Referrer) - 1, 1)])
$oIE^ ERROR

So i know the issue ls to do with this line but cant see why.

Also with text colour _IECreateEmbeded is grey and not blue on my ide same with $oIE.Navigate2

Link to comment
Share on other sites

#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>
#include <IE.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>

Global $Referrer
Local $ReferrerFile = "referrer.txt"
Local $ReferrerExists = FileExists($ReferrerFile)
If $ReferrerExists Then
    _FileReadToArray($ReferrerFile, $Referrer, 0, "")
Else
    MsgBox(0, "Referrer - Setup Error", "The file referrer.txt doesn't exist.")
    Exit
EndIf
If UBound($Referrer) = 0 Then
    MsgBox(0, "Referrer - Setup Error", "The file referrer.txt is empty.")
    Exit
EndIf

Local $oIE = _IECreate()
Local $hoIE = GUICtrlCreateObj($oIE, 8, 8, 500, 500)

$oIE.Navigate2("https://www.whatismyreferer.com/", Default, Default, Default, 'User-Agent: CustomBrowser' & @CRLF & 'Referer: ' & $Referrer[Random(0, UBound($Referrer) - 1, 1)])

GUICtrlDelete($hoIE)

Problem solved this is my code now and seems to be working fine.

Link to comment
Share on other sites

@Ricky1986 - Code looks good, just wanted to add a couple of notes:

#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>
#include <IE.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>

Global $Referrer
Global $ReferrerFile = @ScriptDir & "\referrer.txt"
;~ No reason to have $ReferrerExists as a variable as it's only used once
;~ Local $ReferrerExists = FileExists($ReferrerFile)
If FileExists($ReferrerFile) Then
    _FileReadToArray($ReferrerFile, $Referrer, 0)
    ;~ Use @Error to determine result of _FileReadToArray
    If @error Then
        MsgBox(0, "Referrer - Setup Error", "The file referrer.txt is empty.")
        Exit
    EndIf
Else
    MsgBox(0, "Referrer - Setup Error", "The file referrer.txt doesn't exist.")
    Exit
EndIf

Local $oIE = _IECreate()
;~ GuiCtrlCreateObject is only required if using _IECreateEmbedded
;~ Local $hoIE = GUICtrlCreateObj($oIE, 8, 8, 500, 500)
$oIE.Navigate2("https://www.whatismyreferer.com/", Default, Default, Default, 'User-Agent: CustomBrowser' & @CRLF & 'Referer: ' & $Referrer[Random(0, UBound($Referrer) - 1, 1)])

;~ GUICtrlDelete($hoIE)

 

Link to comment
Share on other sites

Thanks, Subz I will edit it I've been playing with it further and have broken it if you don't mind looking at it so I can understand where I've gone wrong.

#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>
#include <IE.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>

Global $UserAgent
Global $Referrer
Local $UserAgentFile = "UserAgent.txt"
Local $ReferrerFile = "referrer.txt"
Local $UserAgentExists = FileExists($UserAgentFile)
Local $ReferrerExists = FileExists($ReferrerFile)

If $UserAgentExists Then
   _FileReadToArray($UserAgentFile, $UserAgent, 0, "")
Else
   MsgBox(0, "UserAgent - Setup Error", "The File UserAgent.txt doesn't exist.")
   Exit
EndIf
If UBound($UserAgent) = 0 Then
   MsgBox(0, "UserAgent - Setup Error", "The file UserAgent.txt doesn't exist.")
   Exit
   EndIf
If $ReferrerExists Then
    _FileReadToArray($ReferrerFile, $Referrer, 0, "")
Else
    MsgBox(0, "Referrer - Setup Error", "The file referrer.txt doesn't exist.")
    Exit
EndIf
If UBound($Referrer) = 0 Then
    MsgBox(0, "Referrer - Setup Error", "The file referrer.txt is empty.")
    Exit
EndIf

Local $oIE = _IECreate()
Local $hoIE = GUICtrlCreateObj($oIE, 8, 8, 500, 500)

$oIE.Navigate2("http://www.whoishostingthis.com/tools/user-agent/", Default, Default, Default, 'User-Agent: ' & $UserAgent[Random(0, UBound($UserAgent)] - 1,1) & @CRLF & 'Referer: ' & $Referrer[Random(0, UBound($Referrer) - 1, 1)])

GUICtrlDelete($hoIE)

I'm literally just writing and running it best way to learn just need help pick out the errors so I can see my mistakes. 

Link to comment
Share on other sites

Can you try this:

#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>
#include <IE.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>

Global $aUserAgent, $aReferrer
Local $sUserAgentFile = "UserAgent.txt"
Local $sReferrerFile = "referrer.txt"
_FileListArray('UserAgent', $sUserAgentFile, $aUserAgent)
_FileListArray('Referrer', $sReferrerFile, $aReferrer)

Global $oIE = _IECreate()
    $oIE.Navigate2("http://www.whoishostingthis.com/tools/user-agent/", Default, Default, Default, 'User-Agent: ' & $aUserAgent[Random(0, UBound($aUserAgent) - 1, 1)] & @CRLF & 'Referer: ' & $aReferrer[Random(0, UBound($aReferrer) - 1, 1)])

Func _FileListArray($sTitle, $sFileName, ByRef $aArray)
    If FileExists($sFileName) Then
        _FileReadToArray($sFileName, $aArray, 0, "")
        If @error Then
            MsgBox(0, $sTitle & " - Setup Error", "The file " & $sFileName & " is empty.")
            Exit
        EndIf
    Else
        MsgBox(0, $sTitle & " - Setup Error", "The File " & $sFileName & " doesn't exist.")
        Exit
    EndIf
EndFunc

 

Link to comment
Share on other sites

I thought I'd try and alter it to give me a random URL does this work on the same principle or is it different?

#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>
#include <IE.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>

Global $aUserAgent, $aReferrer, $aURLList
Local $sUserAgentFile = "UserAgent.txt"
Local $sReferrerFile = "referrer.txt"
Local $sURLListFile = "URLList.txt"

_FileListArray('UserAgent', $sUserAgentFile, $aUserAgent)
_FileListArray('Referrer', $sReferrerFile, $aReferrer)
_FileListArray('URLList', $sURLListFile, $aURLList)

Global $oIE = _IECreate()
    $oIE.Navigate2('url: ' & $aURLList[Random(0, UBound($aURLList) -1, 1)] Default, Default, Default, 'User-Agent: ' & $aUserAgent[Random(0, UBound($aUserAgent) - 1, 1)] & @CRLF & 'Referer: ' & $aReferrer[Random(0, UBound($aReferrer) - 1, 1)])

Func _FileListArray($sTitle, $sFileName, ByRef $aArray)
    If FileExists($sFileName) Then
        _FileReadToArray($sFileName, $aArray, 0, "")
        If @error Then
            MsgBox(0, $sTitle & " - Setup Error", "The file " & $sFileName & " is empty.")
            Exit
        EndIf
    Else
        MsgBox(0, $sTitle & " - Setup Error", "The File " & $sFileName & " doesn't exist.")
        Exit
    EndIf
EndFunc

 

Link to comment
Share on other sites

18 minutes ago, Subz said:

The forums and the helpfile mostly, I found it to be one of the easiest languages to learn, happy learning :) 

Thanks it seems to be a relatively easy language it's just getting my head around what does what and how to string them together 

Link to comment
Share on other sites

Ricky1986,

The one thing that you are missing is clearing the cookies.

Creating multiple visits with AutoIt will be fairly obvious to whoever your sending these visits at if you have the same cookies.

Theres a few options for doing this:

$cookieFolder = RegRead ("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "Cookies")

MsgBox(0, "The cookies are here: ", $cookieFolder)

FileDelete ($cookieFolder & "\*.txt")

You can dispose of the control and delete them manually

Or you could 

RunWait("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351")

Ask windows to delete the cookies

Or probably even easier you can

;_IEDocGetObj
;https://www.autoitscript.com/autoit3/docs/libfunctions/_IEDocGetObj.htm

$sCookie = "name=richard;password=tehbstpass"

$oIE = _IECreate("http://www.example.com")

$oDocObj = _IEDocGetObj($oIE)

$oDocObj.cookie = $sCookie

Either way if your using the script to increase hits on a website you need:

Random user agent (see attached)

Random proxy

Clean cookies

 

 

UserAgent.txt

Link to comment
Share on other sites

  • Developers

@RichardHawkesford,

Why did you created a second account in our forums?
I will merge the 2 accounts and please stick to the original account.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...