nil.enroll(aetheric_username, quantum_class_id) (adric) wrote,
nil.enroll(aetheric_username, quantum_class_id)

Moodle sql injection works, milestone complete.

## Since the Moodle external enrollment database code doesn't work,
## we fall back to manual SQL injection for MySQL, eg:
        ## +insert into mdl_role_assignments (roleid,contextid,userid,hidden,timestart,timeend,
        ## timemodified,modifierid,enrol,sortorder) VALUES (5,14,10,0,NOW(),0,NOW(), 2, 'manual',0);+

        ##get Moodle context id
        context_id = CONTEXT_DICTIONARY[course_id]

        ## get a real MySQL handle, scary!
        mysql = ActiveRecord::Base.connection

        ### p "Debug: injecting mysql with payload of 5,#{context_id},#{user_id},0,unix_timestamp(),0,unix_timestamp(), 2, 'manual',0"

        injector = "insert into mdl_role_assignments (roleid,contextid,userid,hidden,timestart,timeend,timemodified,modifierid,enrol,sortorder) 
        VALUES (5,#{context_id},#{user_id},0,unix_timestamp(),0,unix_timestamp(), 2, 'manual',0);"

r175 | bsk | 2008-12-13 21:44:28 -0500 (Sat, 13 Dec 2008) | 1 line

even less debug. also, it seems to work on the dev data

That was a few hours, 15 deltas and a lot of documentation and fiddling ago.
Now I'm just screwing around with Trac.
Tags: rails

  • Scripting, iSight, madness, ruby

    So, I banged around in irb and Google working on this whole automate my Mac's built-in camera thing. I'm not averse to buying one of the neat-o cam…

  • Success?! (Yes, more Windows Scripting crap)

    PS C:\Users\Administrator> Get-WmiObject -namespace "root/WebAdministration" -query "select * from VirtualDirectory" | Select-Object…

  • WMI, IIS, CIM and other cursewords

    Finally, after hours of reading through mind-numbingly overcomplicated documentation about the incredible plural architectures for Windows system…

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded