Who can hack this? (Don't modify the code :p)

Post your FreeBASIC source, examples, tips and tricks here. Please don’t post code without including an explanation.
Post Reply
AndT
Posts: 26
Joined: Aug 01, 2007 10:05

Who can hack this? (Don't modify the code :p)

Post by AndT »

Hello everybodey. Who can hack this? It is a game.

You have to Display :"YES YOU DID IT - WRITE A TUTORIAL AND DONE :)" to win.

==--Features--==
- A complex loginsystem
- A little commandline interpreter (the parser is the sub 'makepdata')
- No liniare code to win.
- Some eastereggs
- bugs

And here it is:

Code: Select all

'Defined Restrictionlevels:
'10 System (is not allowd to login)
' 9 Admin
' 8,7,6,5... Users
' 0 Disabled

#include "windows.bi"

Type AccseesData
    AdminInterface as ubyte
    UserMaincontrol as ubyte
    Systemcontrol as ubyte
    Developercontrol as ubyte
end type


Type Account

    AccseesTO as AccseesData

    Name as String
    Password as String
    RestrictionLevel as Integer
    loggedin as bool
    overwriteable as bool
    maxrelogins as ubyte
    relogins as ubyte
end Type

type pdata
    s1 as string
    s2 as string
    s3 as string
end type

function makepdata (mystring as string,obj1 as string,obj2 as string) as pdata
    dim as pdata tmp
    dim as integer i1,i2
    'dim as integer i3 ' ..and so far..
    i1 = instr (mystring,obj1)
    i2 = instr (mystring,obj2)
    tmp.s1 = MID(mystring,1,i1-1)
    tmp.s2 = MID(mystring,i1+1,i2-i1-1)
    tmp.s3 = MID(mystring,i2+1,len(mystring)-i2)
    return tmp
    
    
end function

Sub Logout(Username as String,Password as String,Acc as Account)
    If Username = acc.name and Password = acc.password and acc.loggedin = true then acc.loggedin = false : Print "User '";Username;"' has been succsesfully logged out." else Print "Error can not log out ";acc.name;"."
end sub

function Isloggedin(Username as String,Accountlist() as account) as bool
  
    for i as integer = lbound(Accountlist) to ubound(Accountlist)

        If Accountlist(i).name = Username then
  
            return Accountlist(i).loggedin
        end if
  
    next

    return false
end function

function FindUserid (Username as String,acc() as account) as Integer
    for i as integer = lbound(acc) to ubound(acc)

        if acc(i).Name = Username then return i
    next
    return -1
end function


Sub Main (acc as account)
    
    if acc.loggedin = true then print "Login succsesfull!" else print "Login failed!": exit sub
end sub



Sub Accountmanager(acc as account)
    
    Print "Managing account..";
    if acc.password = "" or acc.Restrictionlevel = 0 then 
        Print "ERROR" 
    else
        Print "Named : ";acc.name
        Print "your Restictionlevel is '";
        dim as integer res = acc.Restrictionlevel
        dim as string Levelname
        acc.overwriteable = true
        select case res
        case 0
            Levelname = "Blocked"
            acc.loggedin = false
            
        case 1 to 8
            Levelname = "User"
            acc.accseesto.UserMaincontrol = true
            acc.overwriteable = false
        case 9
            Levelname = "Admin"
            acc.accseesto.AdminInterface = true
            acc.accseesto.UserMaincontrol = true
            acc.overwriteable = false
        case 10
            Levelname = "System"
            acc.accseesto.Systemcontrol = True
            acc.overwriteable = false
        case else
            Levelname = "Not defined"
            acc.loggedin = false
        end select
        Print Levelname;
        Print "' Account managing complete."
    end if
    
    
end sub
Sub Login(Username as String,Password as String,Accountlist() as Account)
    dim as integer id = Finduserid(Username,accountlist())
    
    
    
    Print "Loginevent - Username : ";Username
    
    for i as integer = lbound(accountlist) to ubound(accountlist)
        if Username = Accountlist(I).Name then
            with accountlist(i)
                if .maxrelogins > 0 then .relogins + = 1
                if .relogins > .maxrelogins then print "Accses denined - To many Logins!" : logout (Username,Password,accountlist(id)) : exit sub
                if .relogins = .maxrelogins + 1 then .loggedin = false : .relogins = .maxrelogins
            end with
            if Password = Accountlist(I).Password and Accountlist(I).Password <> "" then
                if isloggedin(Username,accountlist()) = true then 
                    Print "User is already logged in." 
                    exit sub 
                else 
                    Accountlist(I).loggedin = true
                    end if
                    
                
                Accountlist(I).Password = Password
                Accountmanager(Accountlist(I))
                Main(Accountlist(I))
                exit sub
            else
            end if
        else
    
        end if
    next
    Print "Wrong Username / Password"
        
end sub



Sub LoginUserinterface(Accountlist() as Account)
    If IsLoggedin ("System",Accountlist()) = true then
        Print "Hello - Please log in."
        dim as string uname,upass
        Print "Username";
        Input uname
        Print "Password : ";
        Input upass
        Login uname,upass,Accountlist()
    else
        Print "Accsess denined!"
    end if
    
end sub

sub logoutadmin(acc() as account)
    dim as account _uadmin
    with _uAdmin
    .name = "Admin"
    .password = "Admin"
    .RestrictionLevel =  9
end with
    Logout(_uadmin.name,_uadmin.password,acc(finduserid(_uadmin.Name,acc())))
end sub

sub disableaccount(acc() as account,used_consoleaccount as account)
    acc(3).restrictionlevel = 0
    logout(used_consoleaccount.name,used_consoleaccount.password,acc(finduserid(used_consoleaccount.name,acc())))
end sub


'A very simple Example:

Dim as Account _uSystem,_uAdmin,_uDefaultUser
Dim as bool Missioncomplete = false
with _uSystem
end with

with _uAdmin
    .name = "iamtheadmin"
    .password = "Spiderpig"
    
end with

with _uDefaultUser
    .name = "Default"
    .password = "CriticalDamage"
    .RestrictionLevel = 1
end with

with _usystem
    .name = "System"
    .password = "System"
    .restrictionlevel = 10
    .maxrelogins = 3
end with


dim as account acc(1 to 3)
acc(1) = _usystem
acc(2) = _uadmin
acc(3) = _uDefaultUser

login("System","System",acc(1))
'Main Menu
dim as bool accfound
dim as bool hack_enabled


'This future allwows you to make a hackdll (you can get the password with this.)
dim as any ptr hackdll = dylibload("hackdll")

dim hack as sub (acc() as account) = dylibsymbol(hackdll,"HACK")
if hack > 0 then hack_enabled = true



dim as bool show_info = true    


if hackdll > 0 and hack_enabled = false then 
    dim as string s
    dim as ubyte c
    dim as ubyte a
    s = "ERROR - Bad hackdll (Use a sub named HACK with accountdata) "
    
    do
        sleep 1
        c+=int(rnd*2)
        if c < 64 then c = 64
        a+=1 mod len(s)
        if a = 0 then  a = 1
        color c
        Print chr(asc(s,a));
    loop until inkey <> ""
    dylibfree(hackdll)
    end
    
        
    
end if
dim as string dummy
DO
    Print "Press any key to clear the screen.."
    dummy = INPUT(1)
    cls
    Print "AndT's Hackme Mainmenue- ";
    color 30 : PRINT "MAIN MENU - Your mission: Hack this 'Securitysystem' :D" : color 7
        PRINT "1. Login"
        PRINT "2. Create Systemaccount"
        PRINT "3. Console"
        IF HACK_ENABLED = true then Print "4. Hack" : Print "5. Update _usystem (to get accses for login)"
        PRINT "9. Exit"
        PRINT "HINT: You can make a backdoor with a dll but this is not needed... ;)"
        Print "      "
       
        dim as string i
    DO
        
        I = INPUT (1)
        select case VAL(I)
        case 9
            Print "Bye bye.."
            beep
            dylibfree(hackdll)
            end
        case 1
            dim as integer id
            id = finduserid(_usystem.Name,acc())
            Login(_usystem.name,_usystem.password,acc())
            LoginUserinterface(acc())
            if isloggedin(_usystem.name,acc()) then Logout _usystem.name,_usystem.password,acc(id)
            if id > lbound(acc) and id < ubound(acc) then Logout(_usystem.name,_usystem.password,acc(id))
            sleep 1500
        case 2
          dim  used_consoleaccount as account
            Print "Scanning for users.."
            for i as integer = ubound(acc) to lbound(acc) step -1
                if acc(i).name = "" and acc(i).loggedin = true then acc(i).loggedin = false
                if acc(i).loggedin = true then print "Found : ";acc(i).name : accfound = true : used_consoleaccount = acc(i) :exit for
            next
            if used_consoleaccount.name = "" then print "Failed - you need to login" : exit select
            with acc(1)
                .name = "System"
                .password = "System"
                .restrictionlevel = 10
            end with
            Print "Created"
        case 3
            dim  used_consoleaccount as account
            Print "Scanning for users.."
            for i as integer = ubound(acc) to lbound(acc) step -1
                if acc(i).name = "" and acc(i).loggedin = true then acc(i).loggedin = false
                if acc(i).loggedin = true then print "Found : ";acc(i).name : accfound = true : used_consoleaccount = acc(i) :exit for
            next
            
            
            If used_consoleaccount.Name = "System" then Print "Accsess denined!" : exit select
            if used_consoleaccount.name = "" then accfound = false else Print "Logged in as: ";used_consoleaccount.name
            If accfound = false then print "No users are logged in!" : sleep 1500 : exit do
            Print "Wolcome to the console"
            dim as pdata befehl
            dim as string Eingabe
            dim tme as uinteger = 100
            'if isloggedin(_uSystem.name,acc()) then print "OK" else print "ERROR - Can not run the Console!" : sleep : exit select
            Do
                
                if used_consoleaccount.restrictionlevel = 0 then 
                    
                    
                    dim as integer id = finduserid(used_consoleaccount.name,acc())
                    IF ID = -1 THEN PRINT "Console crashed - Leave console" : sleep : exit select
                    if id >= lbound(acc) or id <= ubound(acc) then logout (used_consoleaccount.name,used_consoleaccount.password,acc(id)) : Print "Account blocked" : else Print "Invailed id"
                    sleep 1500 
                    exit do
                end if
                
                    
                
                if isloggedin(used_consoleaccount.name,acc()) = false then Print "Accound not correct logged in." : sleep 1500 : exit do
                If used_consoleaccount.accseesto.UserMaincontrol = true then Input "CMD : ";Eingabe else Print "Critical: Invailed Login detected - Account disabled" : disableaccount(acc(),used_consoleaccount) : sleep : exit do
                befehl = Makepdata(Eingabe, " ",".")
                select case lcase(befehl.s1)
                
                case "wtf"
                    Print "WTF? HACK ME! NOT CHAT ME!"
                case "beep"
                    beep
                case "exit"
                    exit do
                case "logout"
                    logout(used_consoleaccount.name,used_consoleaccount.password,acc(finduserid(used_consoleaccount.name,acc())))
                case "copy"
                    select case lcase(befehl.s2)
                    case "restriction"
                        dim as string Target = befehl.s3
                        dim as integer Targetid = (finduserid(Target,acc()))
                        dim as integer MyID = finduserid(used_consoleaccount.name,acc())
                        If Targetid = MyID Then pRint "Same account" : exit select
                        If Targetid = -1 or MyID = -1 Then Print "Bad account" : exit select
                        acc(myid).RestrictionLevel = acc(targetid).RestrictionLevel
                        Print "This was changed : "
                        Print "Accound Named '";acc(myid).name;"' have now restictionlevel ";acc(myid).RestrictionLevel;"."
                    end select
                    
                         
                    
                    
                
                        
               
                        
                        
                case "find"
                    select case lcase(befehl.s2)
                    case "adminid"
                        dim as integer id = finduserid("Admin",acc())
                        if id = -1 then Print "Can't find adminid" else print "ID IS : ";ID
                    end select
                case "change"
                    select case lcase(befehl.s2)
                    case "restriction"
                        if used_consoleaccount.restrictionlevel <= 9 then print "This stuff is only for admins" : exit select
'                        if acc(2).restriction <> 9 then disableaccount(acc(),used_consoleaccount)
                        dim as string Target = befehl.s3
                        dim as integer Targetid = (finduserid(Target,acc()))
                        
                        if Targetid < 1 or Targetid > Ubound(acc) then Print "Invailed id."
                        Dim as integer newlevel
                        cls
                        Print "Change restrictionlevel"
                        Print "Targetid : ";Targetid
                        Print "Target : ";Target
                        input "New Restictionlevel : ";newlevel
                        
                        acc(targetid).restrictionlevel = newlevel
                        Accountmanager(acc(targetid))
                    
                    

                    case "username"
                        If used_consoleaccount.accseesto.AdminInterface = true then
                            dim as integer id = val(befehl.s3)
                            if id >=lbound(acc) and id <=ubound(acc) then
                                Input "New Username : ";acc(id).name
                            else
                                Print "Invailed id."
                            end if
                        else
                            Print "Only for admins"
                        end if
                    case "login"
                        Print "Scanning..";
                        dim as integer id = finduserid(befehl.s3,acc())
                        if id > 0 then print "Found" else print "Not found" : exit select
                        dim as string upassw
                        If acc(id).password <> "" then 
                            
                            Print "Password needed"
                            Input "Enterpassword : ";upassw
                        end if
                        
                            if upassw = acc(id).password then 
                                Print "Password correct"
                                Print "Accountchanging in progress.."
                                logout (used_consoleaccount.name,used_consoleaccount.password,acc(finduserid(used_consoleaccount.name,acc())))
                                login  (befehl.s3,upassw,acc())
                                used_consoleaccount = acc(id)
                                print "Changing complete"
                            else
                                Print "Password bad - login denined"
                            end if
                            case else
                        Print "Unknown changing command"
                    end select
                    
                case "open_adminconsole"
                    dim as integer id = finduserid("Admin",acc())
                    if id = -1 then Print "Admin not found!" : exit select
                    if acc(id).accseesto.AdminInterface = true + 1 and isloggedin("Admin",acc()) then
                        Print "Welcome Admin"
                        do
                            Input "Admin CMD : ";Eingabe
                            befehl = Makepdata(Eingabe, " ",".")
                            select case lcase(befehl.s1)
                            case "i"
                                select case lcase(befehl.s2)
                                case "did"
                                    select case lcase(befehl.s3)
                                    case "it?"
                                        PRINT "YES YOU DID IT - WRITE A TUTORIAL AND DONE :)"
                                        dylibfree (hackdll)
                                        sleep
                                        end
                                    end select
                                end select
                            case else
                                tme - = 1
                                if tme = 0 then 
                                    acc(finduserid("Admin",acc())).accseesto.AdminInterface = false : 
                                    Print "Oops!" :
                                    Logoutadmin(acc())
                                    exit do
                                end if
                                
                                    
                                Print "Unkown command Admin - Check your input. You are now tagged as a hacker! " : tme = true
                                
                            end select
                        loop
                    end if
                    
                    
                case "enable_adminconsole"
                    Print "Admin is logged in : ";
                    If IsLoggedIn("Admin",acc()) Then 
                        'Weiter
                        If used_consoleaccount.Restrictionlevel = 9 then
                            Print "Yes"
                            acc(finduserid("Admin",acc())).accseesto.AdminInterface +=1
                            If acc(finduserid("Admin",acc())).accseesto.AdminInterface = true + 1 then
                                Print "Admininterface enabled" 
                            else 
                                Print "denined" :
                                logoutadmin(acc())
                            end if
                            
                        else
                            Print "You are not a admin!"
                        end if
                        
                    else
                        Print "No - Login needed"
                    end if
                
                    
                case else
                    Print "Unknown command"
                end select
            
            loop
            exit do
        case 4
            If Hack_enabled = true then Hack(acc())
        case 5
            If Hack_enabled = true then 
                _usystem = acc(1)
                if _usystem.name <> "" Then Print "Patch complete" else Print "Patch failed (you need to do this in the hackdll)"
            end if
            
            
        case else
            Print "Unknown command"
            
        end select
        if csrlin >=25 then exit do
        sleep 1
    loop
loop
You can make a 'backdoor' (not real but it helps you) with a DLL named: "HACKDLL" written by Freebasic.
The Template for this:

Code: Select all

#include "windows.bi"

Type AccseesData
    AdminInterface as ubyte
    UserMaincontrol as ubyte
    Systemcontrol as ubyte
    Developercontrol as ubyte
end type


Type Account

    AccseesTO as AccseesData

    Name as String
    Password as String
    RestrictionLevel as Integer
    loggedin as bool
    overwriteable as bool
    maxrelogins as ubyte
    relogins as ubyte
end Type

sub HACK alias "HACK" (acc() as account) export
'type your code here
end sub

    
The sourcecode is complete written by me(not optimized... xD) and the inpriation was the console from Uplink. :)

Good look :D
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Post by agamemnus »

Uplink was a great game.

This game is too hard, though. I have no clue how to hack it (without reading the code).
HACK3R ADI
Posts: 27
Joined: Jun 17, 2012 10:16

Re: Who can hack this? (Don't modify the code :p)

Post by HACK3R ADI »

I have never seen such code...

The code is like
'Come here and hack me I will also tell you how to hack me.'

You yourself written a program which hack himself even there is also a vulnerability it in by examining the code a hacker can hack it by changing the value of default user value by using dasm(s) like OllyDbg or using metasploit or injecting code.

It is a self hacking code.....lol
alfakilo
Posts: 117
Joined: Oct 02, 2009 9:18
Location: Estonia

Re: Who can hack this? (Don't modify the code :p)

Post by alfakilo »

deleted
Last edited by alfakilo on Jul 07, 2014 19:28, edited 1 time in total.
Cherry
Posts: 358
Joined: Oct 23, 2007 12:06
Location: Austria
Contact:

Re: Who can hack this? (Don't modify the code :p)

Post by Cherry »

1) Press 1 to log in
2) Log in as Default, password CriticalDamage
3) Press 3 to open the console
4) Enter "copy restriction.System" to get restriction level 10 (man, THAT'S what I call a "local privilege escalation security hole"!!!)
5) Enter "change login.Default" and enter password CriticalDamage to re-login (otherwise the restriction level won't take effect)
6) Enter "change restriction.iamtheadmin" and enter new level 9 in order to get the admin real admin rights (before, the admin account was no admin but had level 0 instead, which means it was blocked)
7) Enter "change login.iamtheadmin" and enter password Spiderpig to log in as the admin account, now with admin rights
8) Enter "change username.2" and enter new name "Admin" to rename the account (some commands require a user named "Admin" - another security hole... authentification through changeable username...)
9) You are automatically logged out because you changed your own name, so press 1 to log in again
10) Log in as Admin, password CriticalDamage
11) It says "invalid username/password", but you can still press 3 to open the console
12) Enter "enable_adminconsole"
13) Enter "open_adminconsole"
14) Enter "i did.it?"
15) Feel like a 1337 h4xx0r

The whole code has a very strange concept, though, especially the user management and the console syntax.
HACK3R ADI
Posts: 27
Joined: Jun 17, 2012 10:16

Re: Who can hack this? (Don't modify the code :p)

Post by HACK3R ADI »

I agree with cherry that whole code and security is strange
qbgenie
Posts: 4
Joined: Feb 18, 2015 3:37

Re: Who can hack this? (Don't modify the code :p)

Post by qbgenie »

if I am reading this right the password is in the compiler
which makeing cracking the app super easy with a DSM or hex editor

To really make it srcure cypher the code,
mrminecrafttnt
Posts: 131
Joined: Feb 11, 2013 12:23

Re: Who can hack this? (Don't modify the code :p)

Post by mrminecrafttnt »

Oh this is fun, ive just updated the code to run with 1.09

Code: Select all

'Defined Restrictionlevels:
'10 System (is not allowd to login)
' 9 Admin
' 8,7,6,5... Users
' 0 Disabled

#include "windows.bi"
#undef true
#undef false

const true = 1
const false = not true

Type AccseesData
    AdminInterface as ubyte
    UserMaincontrol as ubyte
    Systemcontrol as ubyte
    Developercontrol as ubyte
end type


Type Account

    AccseesTO as AccseesData

    Name as String
    Password as String
    RestrictionLevel as Integer
    loggedin as ubyte
    overwriteable as ubyte
    maxrelogins as ubyte
    relogins as ubyte
end Type

type pdata
    s1 as string
    s2 as string
    s3 as string
end type

function makepdata (mystring as string,obj1 as string,obj2 as string) as pdata
    dim as pdata tmp
    dim as integer i1,i2
    'dim as integer i3 ' ..and so far..
    i1 = instr (mystring,obj1)
    i2 = instr (mystring,obj2)
    tmp.s1 = MID(mystring,1,i1-1)
    tmp.s2 = MID(mystring,i1+1,i2-i1-1)
    tmp.s3 = MID(mystring,i2+1,len(mystring)-i2)
    return tmp
    
    
end function

Sub Logout(Username as String,Password as String,Acc as Account)
    If Username = acc.name and Password = acc.password and acc.loggedin = true then acc.loggedin = false : Print "User '";Username;"' has been succsesfully logged out." else Print "Error can not log out ";acc.name;"."
end sub

function Isloggedin(Username as String,Accountlist() as account) as ubyte
  
    for i as integer = lbound(Accountlist) to ubound(Accountlist)

        If Accountlist(i).name = Username then
  
            return Accountlist(i).loggedin
        end if
  
    next

    return false
end function

function FindUserid (Username as String,acc() as account) as Integer
    for i as integer = lbound(acc) to ubound(acc)

        if acc(i).Name = Username then return i
    next
    return -1
end function


Sub Main (acc as account)
    
    if acc.loggedin = true then print "Login succsesfull!" else print "Login failed!": exit sub
end sub



Sub Accountmanager(acc as account)
    
    Print "Managing account..";
    if acc.password = "" or acc.Restrictionlevel = 0 then 
        Print "ERROR" 
    else
        Print "Named : ";acc.name
        Print "your Restictionlevel is '";
        dim as integer res = acc.Restrictionlevel
        dim as string Levelname
        acc.overwriteable = true
        select case res
        case 0
            Levelname = "Blocked"
            acc.loggedin = false
            
        case 1 to 8
            Levelname = "User"
            acc.accseesto.UserMaincontrol = true
            acc.overwriteable = false
        case 9
            Levelname = "Admin"
            acc.accseesto.AdminInterface = true
            acc.accseesto.UserMaincontrol = true
            acc.overwriteable = false
        case 10
            Levelname = "System"
            acc.accseesto.Systemcontrol = True
            acc.overwriteable = false
        case else
            Levelname = "Not defined"
            acc.loggedin = false
        end select
        Print Levelname;
        Print "' Account managing complete."
    end if
    
    
end sub
Sub Login(Username as String,Password as String,Accountlist() as Account)
    dim as integer id = Finduserid(Username,accountlist())
    
    
    
    Print "Loginevent - Username : ";Username
    
    for i as integer = lbound(accountlist) to ubound(accountlist)
        if Username = Accountlist(I).Name then
            with accountlist(i)
                if .maxrelogins > 0 then .relogins + = 1
                if .relogins > .maxrelogins then print "Accses denined - To many Logins!" : logout (Username,Password,accountlist(id)) : exit sub
                if .relogins = .maxrelogins + 1 then .loggedin = false : .relogins = .maxrelogins
            end with
            if Password = Accountlist(I).Password and Accountlist(I).Password <> "" then
                if isloggedin(Username,accountlist()) = true then 
                    Print "User is already logged in." 
                    exit sub 
                else 
                    Accountlist(I).loggedin = true
                    end if
                    
                
                Accountlist(I).Password = Password
                Accountmanager(Accountlist(I))
                Main(Accountlist(I))
                exit sub
            else
            end if
        else
    
        end if
    next
    Print "Wrong Username / Password"
        
end sub



Sub LoginUserinterface(Accountlist() as Account)
    If IsLoggedin ("System",Accountlist()) = true then
        Print "Hello - Please log in."
        dim as string uname,upass
        Print "Username";
        Input uname
        Print "Password : ";
        Input upass
        Login uname,upass,Accountlist()
    else
        Print "Accsess denined!"
    end if
    
end sub

sub logoutadmin(acc() as account)
    dim as account _uadmin
    with _uAdmin
    .name = "Admin"
    .password = "Admin"
    .RestrictionLevel =  9
end with
    Logout(_uadmin.name,_uadmin.password,acc(finduserid(_uadmin.Name,acc())))
end sub

sub disableaccount(acc() as account,used_consoleaccount as account)
    acc(3).restrictionlevel = 0
    logout(used_consoleaccount.name,used_consoleaccount.password,acc(finduserid(used_consoleaccount.name,acc())))
end sub


'A very simple Example:

Dim as Account _uSystem,_uAdmin,_uDefaultUser
Dim as ubyte Missioncomplete = false
with _uSystem
end with

with _uAdmin
    .name = "iamtheadmin"
    .password = "Spiderpig"
    
end with

with _uDefaultUser
    .name = "Default"
    .password = "CriticalDamage"
    .RestrictionLevel = 1
end with

with _usystem
    .name = "System"
    .password = "System"
    .restrictionlevel = 10
    .maxrelogins = 3
end with


dim as account acc(1 to 3)
acc(1) = _usystem
acc(2) = _uadmin
acc(3) = _uDefaultUser

login("System","System",acc())
'Main Menu
dim as ubyte accfound
dim as ubyte hack_enabled


'This future allwows you to make a hackdll (you can get the password with this.)
dim as any ptr hackdll = dylibload("hackdll")

dim hack as sub (acc() as account) = dylibsymbol(hackdll,"HACK")
if hack > 0 then hack_enabled = true



dim as ubyte show_info = true    


if hackdll > 0 and hack_enabled = false then 
    dim as string s
    dim as ubyte c
    dim as ubyte a
    s = "ERROR - Bad hackdll (Use a sub named HACK with accountdata) "
    
    do
        sleep 1
        c+=int(rnd*2)
        if c < 64 then c = 64
        a+=1 mod len(s)
        if a = 0 then  a = 1
        color c
        Print chr(asc(s,a));
    loop until inkey <> ""
    dylibfree(hackdll)
    end
    
        
    
end if
dim as string dummy
DO
    Print "Press any key to clear the screen.."
    dummy = INPUT(1)
    cls
    Print "AndT's Hackme Mainmenue- ";
    color 30 : PRINT "MAIN MENU - Your mission: Hack this 'Securitysystem' :D" : color 7
        PRINT "1. Login"
        PRINT "2. Create Systemaccount"
        PRINT "3. Console"
        IF HACK_ENABLED = true then Print "4. Hack" : Print "5. Update _usystem (to get accses for login)"
        PRINT "9. Exit"
        PRINT "HINT: You can make a backdoor with a dll but this is not needed... ;)"
        Print "      "
       
        dim as string i
    DO
        
        I = INPUT (1)
        select case VAL(I)
        case 9
            Print "Bye bye.."
            beep
            dylibfree(hackdll)
            end
        case 1
            dim as integer id
            id = finduserid(_usystem.Name,acc())
            Login(_usystem.name,_usystem.password,acc())
            LoginUserinterface(acc())
            if isloggedin(_usystem.name,acc()) then Logout _usystem.name,_usystem.password,acc(id)
            if id > lbound(acc) and id < ubound(acc) then Logout(_usystem.name,_usystem.password,acc(id))
            sleep 1500
        case 2
          dim  used_consoleaccount as account
            Print "Scanning for users.."
            for i as integer = ubound(acc) to lbound(acc) step -1
                if acc(i).name = "" and acc(i).loggedin = true then acc(i).loggedin = false
                if acc(i).loggedin = true then print "Found : ";acc(i).name : accfound = true : used_consoleaccount = acc(i) :exit for
            next
            if used_consoleaccount.name = "" then print "Failed - you need to login" : exit select
            with acc(1)
                .name = "System"
                .password = "System"
                .restrictionlevel = 10
            end with
            Print "Created"
        case 3
            dim  used_consoleaccount as account
            Print "Scanning for users.."
            for i as integer = ubound(acc) to lbound(acc) step -1
                if acc(i).name = "" and acc(i).loggedin = true then acc(i).loggedin = false
                if acc(i).loggedin = true then print "Found : ";acc(i).name : accfound = true : used_consoleaccount = acc(i) :exit for
            next
            
            
            If used_consoleaccount.Name = "System" then Print "Accsess denined!" : exit select
            if used_consoleaccount.name = "" then accfound = false else Print "Logged in as: ";used_consoleaccount.name
            If accfound = false then print "No users are logged in!" : sleep 1500 : exit do
            Print "Wolcome to the console"
            dim as pdata befehl
            dim as string Eingabe
            dim tme as uinteger = 100
            'if isloggedin(_uSystem.name,acc()) then print "OK" else print "ERROR - Can not run the Console!" : sleep : exit select
            Do
                
                if used_consoleaccount.restrictionlevel = 0 then 
                    
                    
                    dim as integer id = finduserid(used_consoleaccount.name,acc())
                    IF ID = -1 THEN PRINT "Console crashed - Leave console" : sleep : exit select
                    if id >= lbound(acc) or id <= ubound(acc) then logout (used_consoleaccount.name,used_consoleaccount.password,acc(id)) : Print "Account blocked" : else Print "Invailed id"
                    sleep 1500 
                    exit do
                end if
                
                    
                
                if isloggedin(used_consoleaccount.name,acc()) = false then Print "Accound not correct logged in." : sleep 1500 : exit do
                If used_consoleaccount.accseesto.UserMaincontrol = true then Input "CMD : ";Eingabe else Print "Critical: Invailed Login detected - Account disabled" : disableaccount(acc(),used_consoleaccount) : sleep : exit do
                befehl = Makepdata(Eingabe, " ",".")
                select case lcase(befehl.s1)
                
                case "wtf"
                    Print "WTF? HACK ME! NOT CHAT ME!"
                case "beep"
                    beep
                case "exit"
                    exit do
                case "logout"
                    logout(used_consoleaccount.name,used_consoleaccount.password,acc(finduserid(used_consoleaccount.name,acc())))
                case "copy"
                    select case lcase(befehl.s2)
                    case "restriction"
                        dim as string Target = befehl.s3
                        dim as integer Targetid = (finduserid(Target,acc()))
                        dim as integer MyID = finduserid(used_consoleaccount.name,acc())
                        If Targetid = MyID Then pRint "Same account" : exit select
                        If Targetid = -1 or MyID = -1 Then Print "Bad account" : exit select
                        acc(myid).RestrictionLevel = acc(targetid).RestrictionLevel
                        Print "This was changed : "
                        Print "Accound Named '";acc(myid).name;"' have now restictionlevel ";acc(myid).RestrictionLevel;"."
                    end select
                    
                         
                    
                    
                
                        
               
                        
                        
                case "find"
                    select case lcase(befehl.s2)
                    case "adminid"
                        dim as integer id = finduserid("Admin",acc())
                        if id = -1 then Print "Can't find adminid" else print "ID IS : ";ID
                    end select
                case "change"
                    select case lcase(befehl.s2)
                    case "restriction"
                        if used_consoleaccount.restrictionlevel <= 9 then print "This stuff is only for admins" : exit select
'                        if acc(2).restriction <> 9 then disableaccount(acc(),used_consoleaccount)
                        dim as string Target = befehl.s3
                        dim as integer Targetid = (finduserid(Target,acc()))
                        
                        if Targetid < 1 or Targetid > Ubound(acc) then Print "Invailed id."
                        Dim as integer newlevel
                        cls
                        Print "Change restrictionlevel"
                        Print "Targetid : ";Targetid
                        Print "Target : ";Target
                        input "New Restictionlevel : ";newlevel
                        
                        acc(targetid).restrictionlevel = newlevel
                        Accountmanager(acc(targetid))
                    
                    

                    case "username"
                        If used_consoleaccount.accseesto.AdminInterface = true then
                            dim as integer id = val(befehl.s3)
                            if id >=lbound(acc) and id <=ubound(acc) then
                                Input "New Username : ";acc(id).name
                            else
                                Print "Invailed id."
                            end if
                        else
                            Print "Only for admins"
                        end if
                    case "login"
                        Print "Scanning..";
                        dim as integer id = finduserid(befehl.s3,acc())
                        if id > 0 then print "Found" else print "Not found" : exit select
                        dim as string upassw
                        If acc(id).password <> "" then 
                            
                            Print "Password needed"
                            Input "Enterpassword : ";upassw
                        end if
                        
                            if upassw = acc(id).password then 
                                Print "Password correct"
                                Print "Accountchanging in progress.."
                                logout (used_consoleaccount.name,used_consoleaccount.password,acc(finduserid(used_consoleaccount.name,acc())))
                                login  (befehl.s3,upassw,acc())
                                used_consoleaccount = acc(id)
                                print "Changing complete"
                            else
                                Print "Password bad - login denined"
                            end if
                            case else
                        Print "Unknown changing command"
                    end select
                    
                case "open_adminconsole"
                    dim as integer id = finduserid("Admin",acc())
                    if id = -1 then Print "Admin not found!" : exit select
                    if acc(id).accseesto.AdminInterface = true + 1 and isloggedin("Admin",acc())  then
                            Print "Welcome Admin"
                            do
                                Input "Admin CMD : ";Eingabe
                                befehl = Makepdata(Eingabe, " ",".")
                                select case lcase(befehl.s1)
                                case "i"
                                    select case lcase(befehl.s2)
                                    case "did"
                                        select case lcase(befehl.s3)
                                        case "it?"
                                            PRINT "YES YOU DID IT - WRITE A TUTORIAL AND DONE :)"
                                            dylibfree (hackdll)
                                            sleep
                                            end
                                        end select
                                    end select
                                case else
                                    tme - = 1
                                    if tme = 0 then 
                                        acc(finduserid("Admin",acc())).accseesto.AdminInterface = false : 
                                        Print "Oops!" :
                                        Logoutadmin(acc())
                                        exit do
                                    end if
                                
                                
                                
                                    
                                Print "Unkown command Admin - Check your input. You are now tagged as a hacker! " : tme = true
                                
                            end select
                        loop
                    end if
                    
                    
                case "enable_adminconsole"
                    Print "Admin is logged in : ";
                    If IsLoggedIn("Admin",acc()) Then 
                        'Weiter
                        If used_consoleaccount.Restrictionlevel = 9 then
                            Print "Yes"
                            acc(finduserid("Admin",acc())).accseesto.AdminInterface +=1
                            If acc(finduserid("Admin",acc())).accseesto.AdminInterface = true + 1 then
                                Print "Admininterface enabled" 
                            else 
                                Print "denined" :
                                logoutadmin(acc())
                            end if
                            
                        else
                            Print "You are not a admin!"
                        end if
                        
                    else
                        Print "No - Login needed"
                    end if
                
                    
                case else
                    Print "Unknown command"
                end select
            
            loop
            exit do
        case 4
            If Hack_enabled = true then Hack(acc())
        case 5
            If Hack_enabled = true then 
                _usystem = acc(1)
                if _usystem.name <> "" Then Print "Patch complete" else Print "Patch failed (you need to do this in the hackdll)"
            end if
            
            
        case else
            Print "Unknown command"
            
        end select
        if csrlin >=25 then exit do
        sleep 1
    loop
loop
Post Reply