egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Connecting vBulletin Users Database Table with IRC
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Eggdrop Help
View previous topic :: View next topic  
Author Message
danswano
Voice


Joined: 07 Apr 2011
Posts: 20

PostPosted: Sun Apr 24, 2011 4:41 pm    Post subject: Connecting vBulletin Users Database Table with IRC Reply with quote

Hello, i saw a forum giving auto voice for users who enter with their username/password to the irc channel upon identifying.

What addon to eggdrop can do that? the forum is phpbb but in my case i want it for vbulletin.

The command is custom too like this:
Code:
/msg FORUMNAME "YOUR_FORUM_USERNAME" "YOUR_FORUM_PASSWORD"


is there any script can read the users table in the vb database and read it as user/password in irc or there is a specific addon for such thing?

Thank you for your help. Smile
Back to top
View user's profile Send private message
doggo
Halfop


Joined: 05 Jan 2010
Posts: 97

PostPosted: Sun Apr 24, 2011 5:01 pm    Post subject: Reply with quote

how are the passwords stored in the db md5?
_________________
NON geeky!! http://gotcode4u.com/
Back to top
View user's profile Send private message Visit poster's website
danswano
Voice


Joined: 07 Apr 2011
Posts: 20

PostPosted: Sun Apr 24, 2011 5:12 pm    Post subject: Reply with quote

i guess phpbb using md5 vbulletin aswell.
Back to top
View user's profile Send private message
doggo
Halfop


Joined: 05 Jan 2010
Posts: 97

PostPosted: Sun Apr 24, 2011 6:02 pm    Post subject: Reply with quote

ive tested and seems to work ok..


just edit the SETTINGS part and restart the bot..


usage
Code:
/MSG botnick site_name site_pass



Code:
package require mysqltcl 3.05

namespace eval reqs {
namespace eval sett {

#START SETTINGS 
 
variable req_chan "#YOUR_CHAN"

#DB CONNECTION
variable db_host "DB_HOST"
variable db_port "3306"
variable db_username "DB_USER"
variable db_password "DB_PASS"
variable db_name "DB_NAME"


#CHANNEL USER TABLE
variable db_table "TABLE_NAME"
variable db_user "USERNAME_FIELD"
variable db_pass "MD5_PASSWORDED_FIELD"

#BINDS

bind MSGM -|- "*" reqs::user_add_voice::voice_add_user


#END SETTINGS NAMESPACE
}


# SCRIPT STARTS

namespace eval user_add_voice { 
proc voice_add_user {nick uhost handle text} {

set check_nick [lindex $text 0]
set get_pass [lindex $text 1]

set check_pass [md5 $get_pass]

set find_it [::mysql::connect -host $reqs::sett::db_host -port $reqs::sett::db_port -user $reqs::sett::db_username -password $reqs::sett::db_password -db $reqs::sett::db_name];
set it_find [::mysql::sel $find_it "SELECT $reqs::sett::db_user,$reqs::sett::db_pass FROM $reqs::sett::db_table WHERE $reqs::sett::db_user = '$check_nick' AND $reqs::sett::db_pass = '$check_pass'" -flatlist];
::mysql::endquery $find_it
::mysql::close $find_it

if {$it_find == ""} {putquick "NOTICE $nick :invalid login";return} else {

set valid_nick [lindex $it_find 0]
set valid_pass [lindex $it_find 1]

if {![isvoice $nick $reqs::sett::req_chan] && $check_nick == "$valid_nick" && $check_pass == "$valid_pass"} {

   putquick "MODE $reqs::sett::req_chan +v $nick"
   putquick "NOTICE $nick :thanks for logging in.."

    } else {

           return
         }
      }
   }
}     

#END NAMESPACE
}


** code updated to fix the missing } **
_________________
NON geeky!! http://gotcode4u.com/


Last edited by doggo on Mon Apr 25, 2011 9:18 am; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
danswano
Voice


Joined: 07 Apr 2011
Posts: 20

PostPosted: Sun Apr 24, 2011 7:24 pm    Post subject: Reply with quote

I'm sorry dude but i'm not that pro in eggdrop, where do i paste those settings and do i need additional tcl? Thanks.
Back to top
View user's profile Send private message
doggo
Halfop


Joined: 05 Jan 2010
Posts: 97

PostPosted: Sun Apr 24, 2011 10:11 pm    Post subject: Reply with quote

danswano wrote:
I'm sorry dude but i'm not that pro in eggdrop, where do i paste those settings and do i need additional tcl? Thanks.



if you save all the above code into a file called vb-script.tcl save to the scripts DIR and edit these to match your user database tables

Code:
#DB CONNECTION
variable db_host "DB_HOST"
variable db_port "3306"
variable db_username "DB_USER"
variable db_password "DB_PASS"
variable db_name "DB_NAME"


#CHANNEL USER TABLE
variable db_table "TABLE_NAME"
variable db_nick "USERNAME_FIELD"
variable db_pass "MD5_PASSWORDED_FIELD"



and add the line


Code:
if {[catch {source scripts/vb-script.tcl} err]} {putlog "Error while loading vb-script.tcl: $err"} else {putlog "vb-script.tcl loaded without errors"}


to your eggdrop.conf, then .restart your eggdrop via the partyline
_________________
NON geeky!! http://gotcode4u.com/
Back to top
View user's profile Send private message Visit poster's website
danswano
Voice


Joined: 07 Apr 2011
Posts: 20

PostPosted: Mon Apr 25, 2011 8:39 am    Post subject: Reply with quote

Quote:

Error while loading vb-script.tcl: missing close-brace

when i loaded the scripts in the eggdrop,conf like this:
Code:

source scripts/vb-script.tcl

i got this error
Quote:

[13:03:13] missing close-brace
while executing
"namespace eval reqs {
namespace eval set {

#START SETTINGS
variable req_chan "#chan"

#DB CONNECTION
variable db_host "localhost"
variable db_po..."
(file "scripts/vb-script.tcl" line 3)
invoked from within
"source scripts/vb-script.tcl"
(file "eggdrop.conf" line 219)
[13:03:13] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
Back to top
View user's profile Send private message
doggo
Halfop


Joined: 05 Jan 2010
Posts: 97

PostPosted: Mon Apr 25, 2011 9:19 am    Post subject: Reply with quote

i have tested again and updated the code in the previous post Very Happy

i wrote it late last night, so there were bound to be some errors:P

quick test

Code:
[02:16pm] * doggo sets mode: +h NZB-Bot`
[02:17pm] -> *NZB-Bot`* doggo PiKEYs   < wrong pass!>
[02:17pm] -NZB-Bot`- invalid login
[02:17pm] -> *NZB-Bot`* doggo PiKEY   <correct pass>
[02:17pm] * NZB-Bot` sets mode: +v doggo
[02:17pm] -NZB-Bot`- thanks for logging in..


loads and runs ok

Code:
[14:22] Rehashing ...
[14:22] main_conf.conf loaded without errors
[14:22] egghttp.tcl API v1.1.0 by strikelight now loaded.
[14:22] egghttp.tcl loaded without errors
[14:22] alltools.tcl loaded without errors
[14:22] action.fix.tcl loaded without errors
[14:22] vb_script.tcl loaded without errors
[14:22] Listening at telnet port ******** (all).
[14:22] Userfile loaded, unpacking...

_________________
NON geeky!! http://gotcode4u.com/
Back to top
View user's profile Send private message Visit poster's website
danswano
Voice


Joined: 07 Apr 2011
Posts: 20

PostPosted: Mon Apr 25, 2011 9:25 am    Post subject: Reply with quote

Thanks, it loaded now but i'm getting invalid login

any idea why?
Back to top
View user's profile Send private message
doggo
Halfop


Joined: 05 Jan 2010
Posts: 97

PostPosted: Mon Apr 25, 2011 9:33 am    Post subject: Reply with quote

how are the paswords stored in your database are you sure its md5?
_________________
NON geeky!! http://gotcode4u.com/
Back to top
View user's profile Send private message Visit poster's website
danswano
Voice


Joined: 07 Apr 2011
Posts: 20

PostPosted: Mon Apr 25, 2011 9:34 am    Post subject: Reply with quote

Maybe they changed, it's vbulletin version 4, do you know what they are using? can i help you with something so you can know?
Back to top
View user's profile Send private message
danswano
Voice


Joined: 07 Apr 2011
Posts: 20

PostPosted: Mon Apr 25, 2011 9:43 am    Post subject: Reply with quote

i found something useful here

http://www.vbulletin.com/forum/showthread.php/377595-What-cryptographic-hash-function-is-VBulletin-using-for-user-passwords-protection

Quote:
We use a double md5 hash with a salt. Without the salt its moderately hard to get a value that works for the password.

something like md5(md5(password)salt)
Back to top
View user's profile Send private message
doggo
Halfop


Joined: 05 Jan 2010
Posts: 97

PostPosted: Mon Apr 25, 2011 10:02 am    Post subject: Reply with quote

http://www.vbulletin.com/forum/showthread.php/311252-Encryption-method-of-password?s=254eaaacb5f983ca2d4d841fca9f8658

sounds tricky.. maybe auth users who provide usename and email just to test.. it does what you want..


Code:
package require mysqltcl 3.05

namespace eval reqs {
namespace eval sett {

#START SETTINGS 
 
variable req_chan "#YOUR_CHAN"

#DB CONNECTION
variable db_host "DB_HOST"
variable db_port "3306"
variable db_username "DB_USER"
variable db_password "DB_PASSWORD"
variable db_name "DB_NAME"


#CHANNEL USER TABLE
variable db_table "TABLE_NAME"
variable db_user "USERNAME_FIELD"
variable db_email "EMAIL_FIELD"

#BINDS

bind MSGM -|- "*" reqs::user_add_voice::voice_add_user


#END SETTINGS NAMESPACE
}


# SCRIPT STARTS

namespace eval user_add_voice { 
proc voice_add_user {nick uhost handle text} {

set check_nick [lindex $text 0]
set check_email [lindex $text 1]

set find_it [::mysql::connect -host $reqs::sett::db_host -port $reqs::sett::db_port -user $reqs::sett::db_username -password $reqs::sett::db_password -db $reqs::sett::db_name];
set it_find [::mysql::sel $find_it "SELECT $reqs::sett::db_user,$reqs::sett::db_email FROM $reqs::sett::db_table WHERE $reqs::sett::db_user = '$check_nick' AND $reqs::sett::db_email = '$check_email'" -flatlist];
::mysql::endquery $find_it
::mysql::close $find_it

if {$it_find == ""} {putquick "NOTICE $nick :invalid login";return} else {

set valid_nick [lindex $it_find 0]
set valid_email [lindex $it_find 1]

if {![isvoice $nick $reqs::sett::req_chan] && $check_nick == "$valid_nick" && $check_email == "$valid_email"} {

   putquick "MODE $reqs::sett::req_chan +v $nick"
   putquick "NOTICE $nick :thanks for logging in.."

    } else {

           return
         }
      }
   }
}     

#END NAMESPACE
}



maybe someone else knows how to send the password?
_________________
NON geeky!! http://gotcode4u.com/
Back to top
View user's profile Send private message Visit poster's website
danswano
Voice


Joined: 07 Apr 2011
Posts: 20

PostPosted: Mon Apr 25, 2011 10:10 am    Post subject: Reply with quote

This worked buddy but if anyone knows the user's email will login as him, any idea how to use md5 with salt in your script? Smile
Back to top
View user's profile Send private message
danswano
Voice


Joined: 07 Apr 2011
Posts: 20

PostPosted: Mon Apr 25, 2011 11:48 am    Post subject: Reply with quote

i saw some were trying to get the password for external use but he has a problem because he is using arabic, but can you take a look at his code if it might be useful? Smile

http://www.vbulletin.com/forum/showthread.php/351399-what-the-vBulletindo-to-the-password-%28integration%29?highlight=password+hash

i also found those cases for md5+salt

Code:
– md5($pass.$salt)
– md5($salt.$pass)
– md5($salt.md5($pass))
– md5($salt.$pass.$salt)
– md5($salt.'–'.md5($pass))
– md5(md5($salt).$pass)
– md5(md5($salt).md5($pass))
– md5(md5($pass).$salt)
– md5(md5($pass).md5($salt))
– md5(md5($username.$pass).$salt)
– md5($salt.$pass.$username)
– md5($salt.md5($salt.$pass))
– md5($salt.md5($pass.$salt))
– md5($salt.md5($pass).$salt)
– md5($username.md5($pass).$salt)


can i use them as they are in replacement of?
set check_pass [md5 $get_pass]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Eggdrop Help All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber