Skip to content

Commit

Permalink
More cheatsheets
Browse files Browse the repository at this point in the history
  • Loading branch information
r1cksec committed Sep 17, 2024
1 parent 537cdec commit 6ed8050
Show file tree
Hide file tree
Showing 18 changed files with 1,205 additions and 196 deletions.
2 changes: 1 addition & 1 deletion api/censys.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ curl -s "https://search.censys.io/api/v2/hosts/search?per_page=100&q=autonomous_

### Collect information about multiple hosts
```
cat cidrRanges.txt | xargs -I % sh -c 'echo %\\n; curl -s "https://search.censys.io/api/v2/hosts/search?per_page=100&q=ip:{'%'}" -H "accept: application/json" -H "Authorization: Basic <apiKey>" > $(echo %|tr "/" "_").json ; sleep 3'
cat <cidrRanges>.txt | xargs -I % sh -c 'echo %"\n"; curl -s "https://search.censys.io/api/v2/hosts/search?per_page=100&q=ip:{'%'}" -H "accept: application/json" -H "Authorization: Basic <apiKey>" > $(echo %|tr "/" "_").json ; sleep 3'
```

### Definitions
Expand Down
7 changes: 6 additions & 1 deletion api/leakix.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ curl -s -H "api-key: <apiKey>" -H "accept: application/json" "https://leakix.net

### Collect information about multiple hosts
```
cat hosts.txt | xargs -I % sh -c 'echo %\\n; curl -s -H "api-key: <apiKey>" -H "accept: application/json" "https://leakix.net/host/%" > %.json ; cat %.json; sleep 5'
cat <hosts>.txt | xargs -I % sh -c 'echo %"\n"; curl -s -H "api-key: <apiKey>" -H "accept: application/json" "https://leakix.net/host/%" > %.json ; cat %.json; sleep 5'
```

### Print results
```
ls | xargs -I % sh -c 'cat %' | jq -r '.Services[]? | "\(.ip) ; \(.port) ; \(.http.title)"' | sort -u
```

2 changes: 1 addition & 1 deletion api/shodan.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ curl -s "https://api.shodan.io/shodan/host/<ip>?key=<apiKey>"

### Collect information about multiple hosts
```
cat cidrRanges.txt | xargs -I % sh -c 'echo %\\n; curl -s "https://api.shodan.io/shodan/host/search?key=<apiKey>&query=net:%" > $(echo %|tr "/" "_").json ; sleep 3'
cat cidrRanges.txt | xargs -I % sh -c 'echo %"\n"; curl -s "https://api.shodan.io/shodan/host/search?key=<apiKey>&query=net:%" > $(echo %|tr "/" "_").json ; sleep 3'
```

### Filters
Expand Down
5 changes: 5 additions & 0 deletions api/zoomeye.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,8 @@ site:<site>
title:<title>
```

### Print results of on demand scan
```
jq -r '"\(.ip) ; \(.portinfo.port) ; \(.portinfo.title) ; \(.portinfo.domains)"' <file>.json
```

5 changes: 5 additions & 0 deletions linux/CredMaster.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ Okta - Okta Authentication Portal
OWA - Outlook Web Access
```

### Get aws api gateways
```
aws apigateway --region <region> get-rest-apis | jq -r '.items[] | .id, .name, (.createdDate | todate)'
```

10 changes: 10 additions & 0 deletions linux/aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,13 @@ aws s3 cp ./<directory> s3://<name>/<path>
aws apigateway --region eu-central-1 get-rest-apis
```

### List ssh keys
```
aws ec2 describe-key-pairs
```

### Import ssh key
```
aws ec2 import-key-pair --key-name "<name>" --public-key-material "<sshKey>"
```

5 changes: 5 additions & 0 deletions linux/base64.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Encode string to base64 using UTF-8
```
echo "string" | iconv -t UTF-16LE | base64 -w0
```

9 changes: 4 additions & 5 deletions linux/dnsx.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
### Source
https://github.com/projectdiscovery/dnsx

### Resolve domains to ipv4 from file
### Get mailserver
```
dnsx -silent -a -resp -l <file>
dnsx -silent -l <file> -mx -resp
```

### Get asn of domain
### Get nameserver as json
```
dnsx -silent -l <file> -asn -resp
dnsx -j -silent -l <file> -ns
```

5 changes: 5 additions & 0 deletions linux/nmcli.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ nmcli device set <interface> managed no
nmcli connection
```

### Delete connection
```
nmcli c delete <id>
```

### Show details of a connection
```
nmcli connection show <name>
Expand Down
23 changes: 23 additions & 0 deletions linux/sj.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
### Source
https://github.com/BishopFox/sj

### Install
```
go install github.com/BishopFox/sj@latest
```

### Print endpoints
```
sj endpoints -u <url>
```

### Print curl commands for endpoints
```
sj prepare -u <url>
```

### Test endpoints
```
sj automate -u <url>
```

2 changes: 1 addition & 1 deletion linux/su.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Switch user non-interactively
```
echo <passwor> | su - <user> -c "<command>"
echo <password> | su - <user> -c "<command>"
```

5 changes: 5 additions & 0 deletions linux/yara.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Scan using multiple rules
```
yara $(find . -name "*.yar") <file>
```

2 changes: 1 addition & 1 deletion other/macos-security.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ etc.

### Quarantine Attribute
```
Appended by ths OS to files downloaded via Browsers, Bluetooth, Airdrop
Appended by the OS to files downloaded via Browsers, Bluetooth, Airdrop
Using curl does not append the attribute
```

2 changes: 1 addition & 1 deletion snippet/py/getDate.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
print(createDate)

# alternative
timestamp = datetime.datetime.today().strftime("%d-%m-%Y_%H:%M:%S")
timestamp = datetime.datetime.today().strftime("%d.%m.%Y_%H:%M:%S")
print(timestamp)

Loading

0 comments on commit 6ed8050

Please sign in to comment.