Alpha
Share and Organize Code
login register
HotNewTop
F.A.Q.
1. To begin adding code first register.
2. Create your own tags for code that you add.
3. To see your own code click Me, to see all code click Everyone, or filter by people rob.
4. To follow a user, click on their username, rob and hit follow.
5. Add other code to your library by clicking the
button near the code titles (note that you can not edit these codes).
6. To create a copy of a code that you can edit use fork.
7. If you can't find your code, double check your filter settings as you can filter by Category, User and Tag simultaneously.
8. Add comments to a code by clicking on it's title or the comments link underneath it.

Monitor Who's on Server (plain)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
# --- Script: /usr/local/bin/monitor-who
# --- Author: Paul Greene
# --- Objective: Monitor who's on local server (NODE1) and a remote server (NODE2), from local
# --- server and log it on NODE1
# --- PRE-REQUISISTE: SSH key pair access NEEDS to be set up between NODE1 and NODE2
WHONODE1=`/usr/local/bin/security-who`
WHONODE2=`ssh -p 22 monitor@192.168.1.11 exec /bin/bash -s "$LE_PATH" < /usr/local/bin/security-who`
echo "NODE1: $WHONODE1" | /usr/local/bin/timestamp | tee -ai /var/log/monitor-security-who.log
echo "NODE2: $WHONODE2" | /usr/local/bin/timestamp | tee -ai /var/log/monitor-security-who.log

#!/bin/bash
# --- Script: /usr/local/bin/timestamp
# --- Author: Paul Greene
# --- Objective: Act as a timestamp for log output
while read line ; do
    echo "$(date): ${line}"
done

#!/bin/bash
# --- Script: /usr/local/bin/security-who
# --- Author: Paul Greene
# --- Objective: Capture who's on the server
who -u --lookup

# Enjoy!
[+] (22) more...
comments (1) flag fork
3 Scripts in 1 = Every line that starts with #!/bin/bash is a new script, that needs to be saved in /usr/local/bin - prdgreene 5 Years ago