Jump to content
UBot Underground

how do you check a text file to see if it has more than 1 row?


Recommended Posts

Hi Guys

I am sure this is easy but I cant seem to figure out how to count the rows in a txt file.

 

Here is the scenario

I have a list of txt file of proxies and a txt file of user agents.

 

I have created a command that harvests the user agents.

In the following code is set the proxy.

I then want to set the user agent.

Instead of running the user agent scraper command every time I want to wrap the command with an if statement that checks to see if the file exists first and if it exists it has more than one row. if it does not exist then the command runs and creates it.

 

 

 

How do I wrap the two commands

 

UserAgentHarvestor()

MobileUserAgentHarvestor()

 

The end result I am looking for is to just call the command when I need the proxy and user agent set but want the process to manage itself. I will then drop this command into a loop so everytime the loop runs a new user agent and proxy is used.

I have put the code here so if anyone is looking for something similar they welcome to use it.

 

Any suggestions will be appreciated as well of course.

 

Thanks for any help

 

 

define ManageProxies {

if($comparison(#ProxyOn, "=", "true")) {

then {

if($comparison(#UsePrivateProxies, "=", "true")) {

then {

set(#ProxyList, #PrivateProxies, "Global")

}

else {

set(#ProxyList, #Proxies, "Global")

}

}

clear list(%proxies)

add list to list(%proxies, $list from file(#ProxyList), "Delete", "Global")

set(#ProxyListPosition, 0, "Global")

change proxy($list item(%proxies, #ProxyListPosition))

run javascript("location.reload(true);")

increment(#ProxyListPosition)

}

}

if($comparison(#UseBrowserAgent, "=", "true")) {

then {

UserAgentHarvestor()

clear list(%BrowserUserAgents)

add list to list(%BrowserUserAgents, $list from file("{$special folder("Desktop")}\\DWS-projects\\_appData\\browser-user-agent-list.txt"), "Delete", "Global")

set(#position, $rand(0, 10), "Global")

set user agent($list item(%BrowserUserAgents, #position))

else if($comparison(#UseMobileAgent, "=", "true")) {

MobileUserAgentHarvestor()

clear list(%MobileUserAgents)

add list to list(%MobileUserAgents, $list from file("{$special folder("Desktop")}\\DWS-projects\\_appData\\mobile-user-agent-list.txt"), "Delete", "Global")

set(#position, $rand(0, 10), "Global")

set user agent($list item(%MobileUserAgents, #position))

else {

set user agent("Internet Explorer 10")

}

}

}

}

}

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...