Skip to content

Instantly share code, notes, and snippets.

Verifying that "ankurtyagi.id" is my Blockstack ID. https://onename.com/ankurtyagi
@7h3rAm
7h3rAm / google_search.py
Created May 30, 2016 14:26
Search Google via API Client
from pprint import pprint
from googleapiclient.discovery import build
service = build("customsearch", "v1", developerKey="KEY_HERE")
def search(query):
res = service.cse().list(q=query, cx="CX_ID_HERE").execute()
if 1 <= res["queries"]["request"][0]["totalResults"]:
result = res["items"][0]
response = result["link"] + "\r\n" + result["snippet"]
else:
@7h3rAm
7h3rAm / circllu.py
Last active April 22, 2024 19:35
Query circl.lu API for CVE information.
#!/usr/bin/env python3
from pprint import pprint
import requests
import json
def circllu_cveinfo(cve):
customheaders = {
"User-Agent": "Some script trying to be nice :)"
}
@7h3rAm
7h3rAm / capinfos.py
Last active February 25, 2024 07:47
A pure-Python implementation of Wireshark's capinfos. Supports a few important statistics but is not as exhaustive as the original capinfos tool.
from pprint import pprint
import datetime
import struct
import sys
def capinfos(filename):
# generates wireshark's capinfos like stats
# limited features
# needs additional testing
file_handle = open(filename, 'rb')
@7h3rAm
7h3rAm / secs_to_human
Last active May 10, 2017 15:14
Seconds to human readable text. Inspired from https://gist.github.com/erickpatrick/3039081
#!/usr/bin/env python
def sec_to_human(secs):
units = dict({
7*24*3600: "week",
24*3600: "day",
3600: "hour",
60: "minute",
1: "second"
})
@7h3rAm
7h3rAm / internet.py
Last active April 26, 2021 20:57
Quick Internet Connectivity Test: Invokes a connect on Google's public DNS server: 8.8.8.8:53/TCP with a socket timeout of 1 second.
import socket
def internet(host="8.8.8.8", port=53, timeout=3):
"""
Host: 8.8.8.8 (google-public-dns-a.google.com)
OpenPort: 53/tcp
Service: domain (DNS/TCP)
"""
try:
socket.setdefaulttimeout(timeout)
#!/usr//bin/env python
import sys
if len(sys.argv) != 3:
print "USAGE: %s <KFFSE_XHKYOKXOHOFEDM^E_Y> <0x2a>" % (sys.argv[0])
sys.exit(1)
flag = sys.argv[1]
key = int(sys.argv[2], 16)
#!/usr/bin/env python
import sys
import re
import datetime, time
import argparse
import nids
end_states = (nids.NIDS_CLOSE, nids.NIDS_TIMEOUT, nids.NIDS_RESET)