php - Sending an email via batch file -
okay ultimate goal have autorun file can place in external drive or on flash disk or cd if run execute bunch of crap sends computers ip info me. far have...
a batch file that
opens cmd window , runs ipconfig /all > tcpinfo.txt store ipconfig in filethen file creates html file
echo ^http://anthonyrussell.info/scripts/sendmail.php? computerinfo="this ipconfig info should go"^>^^^ >>sendemail.html`
--the lastly thing batch file executes html file
the html file redirects php page created shoots email out info passed html file created.
so works except cant ipconfig info html code....
any ideas?
below bat code using. sense free run it. have configured if add together in email says altemail= send ever want testing. otherwise gets routed me.
save whatevernameyouwant.bat
cd desktop ipconfig /all > tcpinfo.txt echo ^<html^>^<head^>^<meta http-equiv="refresh"content="0;url=http://anthonyrussell.info/scripts/sendmail.php?computerinfo=ip:127.0.0.1&altemail="^>^</head^>^</html^> >> sendemail.html sendemail.html
update so simplest reply truely best. whole point of scenario capture computer info may or may not have stolen drive or disk.
the thought have autorun->launch batch file -> capture comp info ->create html file -> phone home info
what ended doing instead of capturing public ip command prompt (which convinced can't done) create html file, launch it, , on server capture visitor id email in body along computers name capture in command prompt.
thanks everyones input. fun exercise
you can set ip address ipconfig
statement variable this:
for /f "tokens=2 delims=:" %%a in ('ipconfig ^| find "ipv4"') set ipaddress=%%a
then alter echo to
echo ^<html^>^<head^>^<meta http equiv="refresh"content="0;url=http://anthonyrussell.info/scripts/sendmail.php computerinfo=ip:%ipaddress%&altemail="^>^</head^>^</html^> >> sendemail.html
that beingness said, local ip address, not public, therefor useless. if remember correctly there no native way public ip address.
edit:
you utilize mix of vbs , batch
getip.vbs
dim o set o = createobject("msxml2.xmlhttp") o.open "get", "http://ifconfig.me/ip", false o.send createobject("wscript.shell" ).run "getip.bat" & o.responsetext,0
getip.bat
cd desktop echo ^<html^>^<head^>^<meta http-equiv="refresh"content="0;url=http://anthonyrussell.info/scripts/sendmail.php?computerinfo=ip:%1&altemail="^>^</head^>^</html^> >> sendemail.html sendemail.html
this modified version of solution provided here. note untested.
php html email batch-file ip
No comments:
Post a Comment