Jump to content
UBot Underground

[Sell] Smart Thread Plugin - Easy threading


Recommended Posts

comment("add some sites to list just for example")
clear list(%urls)
add item to list(%urls,"http://www.ubotstudio.com","Delete","Global")
add item to list(%urls,"http://www.bing.com","Delete","Global")
add item to list(%urls,"http://www.ebay.com","Delete","Global")
add item to list(%urls,"http://www.stackoverflow.com","Delete","Global")
divider
comment("add proxies as a list here")
plugin command("Smartthreads.dll", "Thread control Add proxys", "10.1.1.1:80
10.2.2.2.2:80
etc", "Basic List", "")
plugin command("Smartthreads.dll", "Thread control normal", "Test", $list total(%urls), 3, "Yes")
define Test(#pos, #proxy) {
    set(#result,$plugin function("HTTP post.dll", "$http get", $list item(%urls,#pos), $plugin function("HTTP post.dll", "$http useragent string", "Random"), "", #proxy, 10),"Local")
    comment("SCRAPE THE PAGE TITLE")
    alert($find regular expression(#result,"\\<title\\b[^>]*\\>\\s*(?<Title>[\\s\\S]*?)\\</title\\>"))
}

basic example using proxies

Link to post
Share on other sites
  • Replies 185
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Hi James.   I converted the example from the thread you posted. I also removed some of the stuff that was in the script that is not directly required to get the job done:   So here's the ThreadPlugin

So in general. With multithreading there are a couple of things you should be aware of.   1. Threads are running at the same time. So you can't use global variables to store data.  2. Add data to a gl

Duplicate post. I replied in the ExBrowser Thread.   Dan

so can we use multiple defines inside each other?

example: 

(below does not work obviously, just an example. Just wanted to know if we could use defines inside defines, just to keep code easy to edit)

clear list(%urls)
add item to list(%urls,"http://www.ubotstudio.com","Delete","Global")
add item to list(%urls,"http://www.bing.com","Delete","Global")
add item to list(%urls,"http://www.ebay.com","Delete","Global")
add item to list(%urls,"http://www.stackoverflow.com","Delete","Global")
divider
plugin command("Smartthreads.dll", "Thread control normal", "Test", $list total(%urls), 3, "No")
define Test(#pos) {
    set(#result,$plugin function("HTTP post.dll", "$http get", $list item(%urls,#pos), $plugin function("HTTP post.dll", "$http useragent string", "Random"), "", "", 10),"Local")
    comment("SCRAPE THE PAGE TITLE")
    alert($find regular expression(#result,"\\<title\\b[^>]*\\>\\s*(?<Title>[\\s\\S]*?)\\</title\\>"))
    newdefine()
}
define newdefine {
    add item to list(%newlist, $find regular expression(#result, "\\<title\\b[^>]*\\>\\s*(?<Title>[\\s\\S]*?)\\</title\\>"), "Delete", "Global")
}
Link to post
Share on other sites
define newdefine(#result) {
    alert($find regular expression(#result,"\\<title\\b[^>]*\\>\\s*(?<Title>[\\s\\S]*?)\\</title\\>"))
}

yes you can use a define inside just like normal way in ubot. Keep in mind it behaves the same way ubot defines work where local variables are local to that define only in your example the second define would need to look like this. and edit the first define to pass #result in.

Link to post
Share on other sites

Thanks for the quick reply Kev, 

One other question, is it possible to add a predefined list to the proxy function of your plugin?

Sorry, I've had your plugin for a while, just now trying to add it to some bots.

BTW.. your plugin is great, really speeds things up.

Link to post
Share on other sites

Bug :

 

http://i.imgur.com/7We9Ung.png

 

 

Loop 10, Threads 5

 

Test 1 : result 10

Test 2 : result 9

Test 3 : result 10

Test 4 : result 9

Test 5 : result 10

Test 6 : result 9

 

result 10-9-10-9-10-9

Link to post
Share on other sites

Sahin

 

The issue isn't with the plugin. ubots add item to list isn't thread safe. If you require high performance lists use my large date free plugin.

 

thanks

kev123

Link to post
Share on other sites
  • 1 month later...

My question :

 

1. What if i want to attach the proxy to an account. I mean the proxies is on the database attached to each account. Database using sqlite

2. If i use smartthread plugin with bigtable plugin will the multithread safe threads?

 

Thanks

Link to post
Share on other sites

Hi

 

1. You wouldn't use the plugins internal proxy control for this. But you could read accounts from within the thread define or read them all back as one and they pass them as a list to the plugin command such as username:password:proxy:port:proxypass and then split

how do you do it now with normal threads? it should be the similar.

 

2. Yes this would be fine for the commands that require thread safety such as add to list etc.

 

thanks

kev123

Link to post
Share on other sites

Hi

 

1. You wouldn't use the plugins internal proxy control for this. But you could read accounts from within the thread define or read them all back as one and they pass them as a list to the plugin command such as username:password:proxy:port:proxypass and then split

how do you do it now with normal threads? it should be the similar.

 

2. Yes this would be fine for the commands that require thread safety such as add to list etc.

 

thanks

kev123

First i attach a username from sqlite then attach other attribute (password,proxy,etc) of that username. So i don't use list for username. i prefer sqlite as database as it is easier to updating the data

 

Can smartthread plugin work together with sqlite like i describe above?

Link to post
Share on other sites

so if I understand correctly you have a database row that has username in a column , password in other etc.

 

If you read these as and when you need them from the SQLite DB then if the SQLite commands work ok in normal ubot threads they will work ok with the plugin.

 

if you read them out before creating the thread to work with this plugin you would have to read them all out at once and pass in a list to the plugin in the format I showed on my previous post. The thread controller would then pass each list item to a new thread.

 

thanks

Kev123

Link to post
Share on other sites

also this plugin will still only be able to go to the maximum number of threads that you currently achieve with normal ubot threads can.

it just does it faster and easier code.

 

thanks

kev123

Link to post
Share on other sites

Where did i do wrong here ... ?

 

Issue :

1. Stop Button not stopping the threads.

2. The inner loop that create #SubDB is not looping

3. The loop after all threads finished is not running

4. Data missing in the database (If i run using lazy botters it runs perfectly)

 

All 3 files here :

1. MULTITHREADING TEMPLATE KEV 123.ubot : http://www.mediafire.com/download/dirccloob25ylsw/MULTITHREADING_TEMPLATE_KEV_123.ubot

2. MULTITHREADING TEMPLATE LAZY BOTTER.ubot : http://www.mediafire.com/download/3jatzg4tejj6dzd/MULTITHREADING_TEMPLATE_LAZY_BOTTER.ubot

3. test.db : http://www.mediafire.com/download/gsr1ysyghtyab6f/test.db

 

Spec :

- Win 7 64 bit

- 32 GB RAM

- Ubot 5.7.1

MULTITHREADING TEMPLATE KEV 123.ubot

Link to post
Share on other sites

have you got script errors disabled? straight away it brings up a script error "can't convert for interger to string" there seems to be a error somewhere with your code.

 

The thread code seems ok though except that you aren't setting max threads you allowing it to max at what ever the list size is.

Link to post
Share on other sites

ok after checking it appears that the "count from data" SQLite query returns nothing. Are you sure the SQLite plugin can be used like this in threads the other example you sent didn't lazybotters didn't include any SQLite. 

Link to post
Share on other sites

The thread code seems ok though except that you aren't setting max threads you allowing it to max at what ever the list size is.

Since the process is a long process so the threads will be maxed out that is why i want to test with maxed out total threads running

 

ok after checking it appears that the "count from data" SQLite query returns nothing. Are you sure the SQLite plugin can be used like this in threads the other example you sent didn't lazybotters didn't include any SQLite.

Sorry wrong ubot file for lazy botter version. Here is the right version and include sqlite command in it and execute perfectly : http://www.mediafire.com/download/tfxv8yh68q15hcy/MULTITHREADING_TEMPLATE_FIXXX.ubot

 

It has the same sqlite query on both version. So if in lazy botter's version works ok then it should works on smartthread version. right?

Link to post
Share on other sites
set(#Akun,$plugin function("SQLlite.dll", "$sqlite data reader", #DB, "select akun from akun where status is NULL order by random() limit 1;"),"Local")

it looks to be that the above command is causing the DB to lock. this may be because the smarthread is faster and i'm not sure if aymen designed the sqlite plugin to be used like this.

 

The whole point of the smarthread is it allows you to Q threads with there desired parameters.

 

it would be better read all details into a list beforehand and pass them into the thread it also means it will be faster i'll post a example in a following post below.

 

thanks

kev123

Link to post
Share on other sites
comment("you would replace this with your code to read accounts 
you want to process. The smarthread will Q them and can handle very large lists")
comment("for better memory control use large data plugin")
add list to list(%listofaccounts,$list from text("account1
account2
account3
account4
account5
account6
account7
account8
account9
account10
account11
acccount12",$new line),"Delete","Global")
comment("___________________________________________________________")
divider
set(#maxthreads,10,"Global")
plugin command("Smartthreads.dll", "Threadcontrol Advanced initial", #maxthreads)
plugin command("Smartthreads.dll", "Thread control Advanced add", "test", "List", %listofaccounts, "No")
plugin command("Smartthreads.dll", "Thread control Advanced finish wait")
define test(#row, #account) {
    alert(#account)
}

please see code for example

Link to post
Share on other sites

I tried your codes and add my data into it but got only 1 result and seems the #row not increasing

 

clear all data

comment("you would replace this with your code to read accounts

you want to process. The smarthread will Q them and can handle very large lists")

comment("for better memory control use large data plugin")

ui button("Stop") {

plugin command("Smartthreads.dll", "Smart thread stop")

}

set(#DB,"D:\\TEMP-DEL\\test.db","Global")

plugin command("Bigtable.dll", "Clear all large list")

plugin command("Bigtable.dll", "large List from text", "Akun", $plugin function("SQLlite.dll", "$sqlite data reader", #DB, "select akun from akun;"), $new line, "replace")

set(#ListTotal,$plugin function("Bigtable.dll", "Large list total", "Akun"),"Global")

comment("___________________________________________________________")

divider

set(#maxthreads,#ListTotal,"Global")

plugin command("Smartthreads.dll", "Threadcontrol Advanced initial", #maxthreads)

plugin command("Smartthreads.dll", "Thread control Advanced add", "test", "List", "Akun", "No")

plugin command("Smartthreads.dll", "Thread control Advanced finish wait")

define test(#row, #account) {

set(#account,$plugin function("Bigtable.dll", "Large list item", "Akun", #row),"Local")

add item to list(%Result,#account,"Don\'t Delete","Global")

}

 

 

What did i do wrong?

Link to post
Share on other sites

this one works but never got the same amount between source and result

 

source = 100

result < 100

 

clear all data

comment("you would replace this with your code to read accounts

you want to process. The smarthread will Q them and can handle very large lists")

comment("for better memory control use large data plugin")

ui button("Stop") {

plugin command("Smartthreads.dll", "Smart thread stop")

}

set(#DB,"D:\\TEMP-DEL\\test.db","Global")

loop(0) {

plugin command("Bigtable.dll", "Clear all large list")

plugin command("Bigtable.dll", "large List from text", "Akun", $plugin function("SQLlite.dll", "$sqlite data reader", #DB, "select akun from akun;"), $new line, "replace")

}

add list to list(%Akun,$list from text($plugin function("SQLlite.dll", "$sqlite data reader", #DB, "select akun from akun;"),"

"),"Delete","Global")

comment("___________________________________________________________")

divider

set(#maxthreads,$list total(%Akun),"Global")

plugin command("Smartthreads.dll", "Threadcontrol Advanced initial", #maxthreads)

plugin command("Smartthreads.dll", "Thread control Advanced add", "test", "List", %Akun, "No")

plugin command("Smartthreads.dll", "Thread control Advanced finish wait")

define test(#row, #account) {

add item to list(%Result,#account,"Don\'t Delete","Global")

}

Link to post
Share on other sites
add item to list(%Result,#account,"Don\'t Delete","Global")

the problem with your first example as you didn't you needed to use large list return. instead you just put the name of the list.

 

The above code isn't thread safe, also it probably would cause issues with the large data plugin as what your trying to do is instantly add all items to the list

 

now you know how touse the plugin try integrating into real world example

Link to post
Share on other sites

 

add item to list(%Result,#account,"Don\'t Delete","Global")
the problem with your first example as you didn't you needed to use large list return. instead you just put the name of the list.

 

The above code isn't thread safe, also it probably would cause issues with the large data plugin as what your trying to do is instantly add all items to the list

 

now you know how touse the plugin try integrating into real world example

Sorry i did not understand

 

I try this :

 

clear all data

comment("you would replace this with your code to read accounts

you want to process. The smarthread will Q them and can handle very large lists")

comment("for better memory control use large data plugin")

ui button("Stop") {

plugin command("Smartthreads.dll", "Smart thread stop")

}

set(#DB,"D:\\TEMP-DEL\\test.db","Global")

plugin command("Bigtable.dll", "Clear all large list")

plugin command("Bigtable.dll", "large List from text", "Akun", $plugin function("SQLlite.dll", "$sqlite data reader", #DB, "select akun from akun;"), $new line, "replace")

comment("___________________________________________________________")

divider

set(#maxthreads,$plugin function("Bigtable.dll", "Large list total", "Akun"),"Global")

plugin command("Smartthreads.dll", "Threadcontrol Advanced initial", #maxthreads)

plugin command("Smartthreads.dll", "Thread control Advanced add", "test", "List", "Akun", "No")

plugin command("Smartthreads.dll", "Thread control Advanced finish wait")

define test(#row, #account) {

alert(#account)

}

 

 

Result :

- Only 1 loop

- Alert : Akun

 

What did i do wrong here?

Link to post
Share on other sites
plugin command("Smartthreads.dll", "Thread control Advanced add", "test", "List", "Akun", "No")

What I said in previous post akun is a string. all your passing to the thread control is a string. you need to use the "large list return" command in its place.

 

recommend looking at the large data plugin thread and examples that come with it.

 

thanks

kev123

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...