Menu

X-Windows vs. Screen

Eric Milam

smbexec attempts to see if X-Windows is running, if it is the metasploit console session will launch in an Xterm Window. If X is not detected, then the session is launched in screen.

# Check to see if X is running
if [ -z $(pidof X) ] && [ -z $(pidof Xorg) ]; then
    isxrunning=
else
    isxrunning=1
fi

However we've added some options in the top of the source so you can have the program always launch in screen or always in Xterm (like when tunneling X over SSH)

# Uncomment the following line to launch Metasploit in a screen session...
# unset isxrunning

# Uncomment the following line to launch Metasploit in an xterm window...
#isxrunning=1

This will give you a bit more control since we don't know what environment you will be running in.

There are a few tips with regards to using screen:

  • If you are launching smbexec from within a screen session, a new screen within a screen will be created. In order to get back to the original screen to complete the attack you must press ctrl-a then a again and then d after msfconsole launches

  • If you are launching smbexec from within a standard command prompt and X windows is not running, you press ctrl-a then d to detach and complete the attack after msfconsole launches.