This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# script generates a CSV file listing details of all EC2 instances across AWS regions, including instance ID, type, associated EBS volume IDs, | |
# sizes, types, the instance name from its tags, and all other tags, outputting this information into a structured format. | |
echo "Region,Instance ID,Instance Type,Volume IDs,Volume Sizes,Volume Types,Instance Name,Tags" > /tmp/ec2-data.csv | |
aws ec2 describe-regions --query "Regions[].RegionName" --output text | tr '\t' '\n' | while read region; do | |
# Fetch volume details (including size and type) and store in a file | |
aws ec2 describe-volumes --region "$region" --query 'Volumes[]' --output json | jq -r 'reduce .[] as $item ({}; .[$item.VolumeId] = {"Size": ($item.Size | tostring), "Type": $item.VolumeType})' > /tmp/volumeDetails.json | |
# Fetch instance details and include volume size and type along with the instance name | |
aws ec2 describe-instances --region "$region" --query 'Reservations[].Instances[]' --output json | jq -r --arg region "$region" --slurpfile volumeD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Write some notes here | |
# what this does | |
# example output | |
from scrapli.driver.core import IOSXRDriver | |
from scrapli.exceptions import ScrapliException | |
import getpass | |
import os | |
from collections import defaultdict |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
show system snapshot media internal | display xml rpc | |
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/20.2R0/junos"> | |
<rpc> | |
<get-snapshot-information> | |
<media>internal</media> | |
</get-snapshot-information> | |
</rpc> | |
<cli> | |
<banner></banner> | |
</cli> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ntp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ip-ntp-cfg"> | |
<interface-tables> | |
<interface-table> | |
<vrf-name>default</vrf-name> | |
<interface> | |
<interface>{{ PORTNAME }}</interface> | |
<disable/> | |
</interface> | |
</interface-table> | |
</interface-tables> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RT_FLOW_SESSION_CREATE Grok pattern | |
Trying to extract data from message into , leaving the original intact. | |
Condition | |
Will only attempt to run if the message matches the regular expression RT_FLOW_SESSION_CREATE | |
Configuration | |
grok_pattern: %{HOSTNAME} %{WORD:RT_FLOW_NAME}: %{WORD:RT_FLOW_TYPE}: session created %{IP:source_address}/%{NUMBER:source_port}->%{IP:destination_address}/%{NUMBER:destination_port} %{WORD:connection_tag} %{DATA:service_name} %{IP:nat_source_ip}/%{NUMBER:nat_source_port}->%{IP:nat_dest_ip}/%{NUMBER:nat_dest_port} %{DATA:src_nat_rule_name} %{DATA:dest_nat_rule_name} %{NUMBER:protocol_id} %{DATA:policy_name} %{DATA:source_zone} %{DATA:dest_zone} %{NUMBER:session_id} %{DATA:username} %{DATA:packet_incoming_interface} %{DATA} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##TCP FLAGS## | |
Unskilled Attackers Pester Real Security Folks | |
============================================== | |
TCPDUMP FLAGS | |
Unskilled = URG = (Not Displayed in Flag Field, Displayed elsewhere) | |
Attackers = ACK = (Not Displayed in Flag Field, Displayed elsewhere) | |
Pester = PSH = [P] (Push Data) | |
Real = RST = [R] (Reset Connection) | |
Security = SYN = [S] (Start Connection) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import subprocess | |
import json | |
from bottle import route, run, template | |
@route('/hello/<name>') | |
def index(name): | |
out = subprocess.Popen(['/usr/bin/mtr', '-j', '-Z', '1', '-c', '1', '1.1.1.1'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | |
stdout,stderr = out.communicate() | |
d = json.loads(stdout) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# made by OMGKitteh on #juniper | |
import requests | |
from string import maketrans | |
import re | |
words_url = 'https://github.com/dwyl/english-words/blob/master/words.txt?raw=true' | |
letters = { | |
"a": "4", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# located at /etc/netplan/ | |
# $ sudo netplan apply | |
network: | |
version: 2 | |
renderer: networkd | |
ethernets: | |
enp5s0f0: | |
dhcp4: false | |
bridges: | |
br0: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set aws profile in shell | |
414 alias ap=aws_profile | |
415 read_ini() { | |
416 local file=$1 | |
417 local section=$2 | |
418 cat $1 | grep -n1 "$2" | grep "region" | awk '{print $3}' | |
419 } | |
420 aws_profile() { | |
421 unset AWS_PROFILE AWS_REGION AWS_DEFAULT_REGION | |
422 if [[ -n $1 ]]; then |
NewerOlder