Skip to content

Instantly share code, notes, and snippets.

View dpnishant's full-sized avatar
🎯
Focusing

Nishant Das Patnaik dpnishant

🎯
Focusing
View GitHub Profile
@dpnishant
dpnishant / dump-indexeddb.js
Created July 15, 2022 13:22
dump indexedDB
const dbName = "users"; //
const tableName = "dbsignin"; //
const dbReq = indexedDB.open(dbName, 1);
const dumpTable = function(event) {
const db = dbReq.result;
const objectStore = db.transaction([tableName]).objectStore(tableName);
objectStore.openCursor().onsuccess = (event) => {
const cursor = event.target.result;
if (cursor) {
@dpnishant
dpnishant / unJSF*ck.js
Last active March 29, 2018 00:55
Node.JS snippet to de-obfuscate JSF*ck javascript obfuscator.
const deobfuscate = (obfuscated) => {
var vm = require('vm');
let constructor = "[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]";
let code = obfuscated.replace(constructor, '').replace(/\(\)$/, '').replace(/^\(/, '').replace(/\)$/, '')
var sleep = require('sleep').sleep;
process.on('message', function (message) {
console.log('message from parent:', message);
});
if (process.send) {
for (let i=0, len = 100; i < len; i++) {
sleep(1);
process.send(`Hello-${i}`);
@dpnishant
dpnishant / canvasrecord.js
Created November 6, 2016 19:03 — forked from PaulKinlan/canvasrecord.js
Screen recorder in JS
let canvas = document.querySelector('canvas');
// Optional frames per second argument.
let stream = canvas.captureStream(25);
let recorder = new MediaRecorder(stream, options);
let blobs = [];
function download(blob) {
var url = window.URL.createObjectURL(blob);
var a = document.createElement('a');
a.style.display = 'none';
@dpnishant
dpnishant / README.md
Created October 20, 2016 19:39 — forked from hofmannsven/README.md
My simply Git Cheatsheet
var page = require('webpage').create();
var system = require('system');
page.onConsoleMessage = function(msg) {
system.stderr.writeLine('Console Message: ' + msg);
};
page.onInitialized = function() {
page.evaluate(function() {
document.addEventListener('DOMContentLoaded', function() {
10a11,13
> apt-get install -y aptitude
> aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
> add-apt-repository ppa:ondrej/php
16,19c19,22
< apt-get install -y php5
< apt-get install -y php5-common
< apt-get install -y php5-curl
< apt-get install -y libapache2-mod-php5
---
@dpnishant
dpnishant / postMessage_security.md
Last active February 2, 2016 11:16 — forked from jedp/gist:3005816
postMessage() security review checklist

Security-Reviewing Uses of postMessage()

The postMessage() API is an HTML5 extension that permits string message-passing between frames that don't share the same origin. It is available in all modern browsers. It is not supported in IE6 and IE7.

postMessage is generally considered very secure as long as the programmer is careful to check the origin and source of an arriving

@dpnishant
dpnishant / classifier.py
Last active December 14, 2015 11:31 — forked from zacstewart/classifier.py
Document Classification with scikit-learn
import os
import numpy
from pandas import DataFrame
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import MultinomialNB
from sklearn.pipeline import Pipeline
from sklearn.cross_validation import KFold
from sklearn.metrics import confusion_matrix, f1_score
NEWLINE = '\n'
@dpnishant
dpnishant / cframebusting.js
Created February 27, 2015 10:12
Conditional Framebusting
function matchInArray(arr, subject) {
var parser = document.createElement('a');
parser.href = subject; //using DOM-trickery to parse URLs
if(Object.prototype.toString.call(arr) !== '[object Array]') {
arr = arr.split(); //array typecast
}
if((new RegExp('\\b' + arr.join('\\b|\\b') + '\\b')).test(parser.hostname)) {
return true;