Sysadmin Notes

Pingsweep of subnet:

# nmap -sP 10.0.0.1-255

Get a list of users on Windows:

> net use \x.x.x.xipc$ “” /USER:””
> net users

What is the password policy:

> net accounts

Recover a lost password:

> enum -u Aministrator -f c:dict.txt -D x.x.x.x

Logon remotely:

> psexec \x.x.x.x -u Administrator cmd.exe

Transfer a file with netcat:

$ nc -l -p 6969 > file.txt
$ nc somehost 6969 < file.txt

Listen for passwords flying on the subnet:

# sudo dsniff

Reset the root password on an old server:

$ sshnuke 10.2.2.2 -rootpw-“Z1ON0101”

Makeshift remote desktop:

From server:

vncserver

you will enter password and the server will start running on port 6000 or so. From client:

xvncviewer

Tomcat

Create a serlf signed SSL certificate for Tomcat.

mkdir ssl
cd ssl
openssl req -new -out REQ.pem -keyout KEY.pem
openssl req -x509 -in REQ.pem -key KEY.pem -out CERT.pem
openssl req -verify -in REQ.pem
openssl req -verify -in REQ.pem -key KEY.pem
openssl req -text -in REQ.pem

Backup old SSL key just in case something goes wrong

mkdir old_ssl
cp /usr/local/tomcat/.keystore old_ssl/keystore

Stop Tomcat

/etc/init.d/tomcat stop

Delete the Tomcat certificate from the keystore and install new one

sudo ln /usr/local/tomcat/.keystore /root/.keystore
sudo /usr/java/jdk1.6.0/bin/keytool -delete -alias tomcat
sudo /usr/java/jdk1.6.0/bin/keytool -import -v -trustcacerts -alias tomcat -file CERT.pem

Start Tomcat

sudo /etc/init.d/tomcat start