Skip to content

Instantly share code, notes, and snippets.

View yelkhatib's full-sized avatar

Yehia Elkhatib yelkhatib

View GitHub Profile
@yelkhatib
yelkhatib / domainNames.sh
Last active August 18, 2023 17:07
Get a list of unique resource domains from a HAR file. Uses jq to parse the HAR file.P.S. You could create HAR files using a number of tools, such as PhantomJS, hdrgrab or chrome-HAR-capturer.
#list unique resource domains
jq '.log.entries[].request | {method,url}' $1 | jq 'if .method=="GET" then .url else "" end' | grep -Eo "http(s?)://([^/]+)./" | sort | uniq
@yelkhatib
yelkhatib / clientInfoInNode.js
Created July 6, 2012 01:36
Getting Client information in NodeJS
function onRequest(request, response) {
var clientIPaddr = null,
clientProxy = null;
// is client going through a proxy?
if (request.headers['via']) { // yes
clientIPaddr = request.headers['x-forwarded-for'];
clientProxy = request.headers['via'];
} else { // no
clientIPaddr = request.connection.remoteAddress;