Hey, I'm working on a net use dictionary security tool to check my local network. I've been playing around with a few things and have come up with this for the tool. (This is not for illegal purposes). Anyhow, this is the code that I have come up with and tried on one of my computers on the network. I'm working on speed and the thing that is bringing me down is the file that is opened to check for a successful password. Is there a way around this? Also, when there is an error, It outputs Access Is Denied on the screen, even though I thought it would be piped to the temp file. If anyone has any ideas on how to correct some of these issues please let me know. Any advise would be appreciated. Also, because I know this can be a touchy subject, if this does go against any rules it can be deleted. I appologize in advance, but have no where to look for answers.
Thanks,
CharIie
Some inputs such as ip, files, shares etc are input earlier in the program.
Thanks,
CharIie
Some inputs such as ip, files, shares etc are input earlier in the program.
Code:
fstream dict(dictionary.c_str()); //Opens Dictionary File
if(!dict) //Checks If Dictionary File Exists
{
cerr << "\nBad File Name, Quiting.\n";
break;
}
string dictit;
string successcheck;
if(dict.is_open())//Checks If Dictionary Is Open
{
while(!dict.eof())//Loops through whole file
{
getline(dict, dictit); //Gets dictionary passwords
string dictatt = ("net use x: \\\\" + ip + "\\" + share + " /USER:" + user + " " + dictit " >> check.temp");
system(dictatt.c_str()); //Calls System Command
ifstream pchk("check.temp");
if(pchk.is_open())
{
while(!pchk.eof())
getline(pchk, successcheck);
if(successcheck == "The command completed successfully.")
{
cout << "\nPassword is " << dictit << ". You are connected.";
break;
}
}else
pchk.close();
}
remove("check.temp");
}
dict.close();