Browse Source

Update README.md

pull/123/head
lbonanomi 5 years ago
committed by GitHub
parent
commit
903ce1892b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 0 deletions
  1. +24
    -0
      README.md

+ 24
- 0
README.md View File

@@ -3806,6 +3806,7 @@ grep "\-\-" filename

- [Domain resolve](#domain-resolve)
- [Get ASN](#get-asn)
- [Store script files as gists](#scriptfiles-to-Gists)

###### Domain resolve

@@ -3888,3 +3889,26 @@ shell> GetASN 1.1.1.1
shell> GetASN 0.0.0.0
Unsuccessful ASN gathering.
```

###### scriptfiles to Gists

function scripto() {
# Automatically upload /bin/script scriptfiles as Github.com gists

# Sane API token?
curl -Insw "%{http_code}" https://api.github.com/user | tail -1 | grep -q 200 || (echo "Can't reach API" && return 1)

# Instance a gist and clone it
GISTID=$(curl -nksd '{"files":{"sfile":{"content":"scriptfile in-flight"}}}' https://api.github.com/gists | awk -F"\"" '$2 == "id" {print $4}' | head -1);
git clone -q "https://gist.github.com/"$GISTID".git" ~/$GISTID &>/dev/null;

# API and gist can use the same token but need different addresses, check we can push back a complete gist
if (cd ~/$GISTID && git push &>/dev/null || return 2)
then
script -qf ~/$GISTID/sfile && (cd ~/$GISTID && git add * && git commit -m "." && git push origin && rm -rf ~/$GISTID/.git ~/$GISTID/sfile && rmdir ~/$GISTID);
curl -nks -X PATCH -d '{ "files":{ "sfile": { "filename":"'$(hostname)' typescript"}}}' https://api.github.com/gists/$GISTID >/dev/null
else
echo "No token for gist.github.com"
rm -rf ~/$GISTID/.git ~/$GISTID/sfile && rmdir ~/$GISTID
fi
}

Loading…
Cancel
Save