This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Connecting vBulletin Users Database Table with IRC

General support and discussion of Eggdrop bots.
d
danswano
Voice
Posts: 20
Joined: Thu Apr 07, 2011 7:53 am

Connecting vBulletin Users Database Table with IRC

Post by danswano »

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: Select all

/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. :)
d
doggo
Halfop
Posts: 97
Joined: Tue Jan 05, 2010 7:53 am
Contact:

Post by doggo »

how are the passwords stored in the db md5?
d
danswano
Voice
Posts: 20
Joined: Thu Apr 07, 2011 7:53 am

Post by danswano »

i guess phpbb using md5 vbulletin aswell.
d
doggo
Halfop
Posts: 97
Joined: Tue Jan 05, 2010 7:53 am
Contact:

Post by doggo »

ive tested and seems to work ok..


just edit the SETTINGS part and restart the bot..


usage

Code: Select all

/MSG botnick site_name site_pass

Code: Select all

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 } **
Last edited by doggo on Mon Apr 25, 2011 9:18 am, edited 2 times in total.
d
danswano
Voice
Posts: 20
Joined: Thu Apr 07, 2011 7:53 am

Post by danswano »

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.
d
doggo
Halfop
Posts: 97
Joined: Tue Jan 05, 2010 7:53 am
Contact:

Post by doggo »

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: Select all

#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: Select all

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
d
danswano
Voice
Posts: 20
Joined: Thu Apr 07, 2011 7:53 am

Post by danswano »

Error while loading vb-script.tcl: missing close-brace
when i loaded the scripts in the eggdrop,conf like this:

Code: Select all

source scripts/vb-script.tcl
i got this error
[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)
d
doggo
Halfop
Posts: 97
Joined: Tue Jan 05, 2010 7:53 am
Contact:

Post by doggo »

i have tested again and updated the code in the previous post :D

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

quick test

Code: Select all

[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: Select all

[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...
d
danswano
Voice
Posts: 20
Joined: Thu Apr 07, 2011 7:53 am

Post by danswano »

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

any idea why?
d
doggo
Halfop
Posts: 97
Joined: Tue Jan 05, 2010 7:53 am
Contact:

Post by doggo »

how are the paswords stored in your database are you sure its md5?
d
danswano
Voice
Posts: 20
Joined: Thu Apr 07, 2011 7:53 am

Post by danswano »

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?
d
danswano
Voice
Posts: 20
Joined: Thu Apr 07, 2011 7:53 am

Post by danswano »

i found something useful here

http://www.vbulletin.com/forum/showthre ... protection
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)
d
doggo
Halfop
Posts: 97
Joined: Tue Jan 05, 2010 7:53 am
Contact:

Post by doggo »

http://www.vbulletin.com/forum/showthre ... 1fca9f8658

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

Code: Select all

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?
d
danswano
Voice
Posts: 20
Joined: Thu Apr 07, 2011 7:53 am

Post by danswano »

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? :)
d
danswano
Voice
Posts: 20
Joined: Thu Apr 07, 2011 7:53 am

Post by danswano »

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? :)

http://www.vbulletin.com/forum/showthre ... sword+hash

i also found those cases for md5+salt

Code: Select all

– 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]
Post Reply