Skip to content

Instantly share code, notes, and snippets.

View chrdek's full-sized avatar
♻️
Fully reCaptcha resistant....

ChrDek chrdek

♻️
Fully reCaptcha resistant....
  • Ham
  • Bacon
View GitHub Profile
@chrdek
chrdek / scriptlets1.js
Created June 14, 2020 19:58
MongoDB cmd line sample code for bulk operations
/*** Get documents with specific name from collection ***/
db.getCollection('TableName1').find({Name:"Type1"})
/*** Get all documents from specific collection ***/
db.getCollection('TableName1').find({})
/*** Update one documemt field via upsert ***/
db.TableName1.update({Name:{$eq:"Type1"}},
{$set:{Id:"UPDATED1-1"}},
{upsert:true})
@chrdek
chrdek / client_connect.bat
Last active June 14, 2020 19:35
Client connection sample with https headers for self-signed cert.
curl -i https://localhost:443/loginconfig -1 -H "Cache-Control:no-cache" -H "Authorization:Basic cGFpcjAyOmRpY2ZlY2plZ2RqaGdmZWhqZmppYWNlZWFnYWNoYmFoYWNhaWo=" -H "Accept:*/*" -X GET --connect-timeout 3 -k
@chrdek
chrdek / ssl-sample2.js
Created June 13, 2020 19:59
Login server with basic secure cookie authentication and json file as data store (log reqs).
var https = require('https');
var fs = require('fs');
var auth = require('basic-auth');
var cookie = require('cookie');
var signed = require('cookie-signature');
const csvconv = require('csvtojson');
const { parse } = require('json2csv');
const express = require('express');
const routing = express();
@chrdek
chrdek / ssl-sample1.js
Created June 13, 2020 19:43
Login server with secure cookie handling via https
var https = require('https');
var fs = require('fs');
var auth = require('basic-auth');
var cookie = require('cookie');
var signed = require('cookie-signature');
const express = require('express');
const routing = express();
const error = '<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>Error</title><head><body><pre>Cannot load page: [GET]</pre></body></html>';
const initialpage = '<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>Data Loaded</title><head><body><hr/><i>User Data Loaded</i><hr/></body></html>';
@chrdek
chrdek / Obf-PS.ps1
Created May 17, 2020 14:54
Automated dll file obfuscation via confuser.
$execobf = [ScriptBlock]{
[string[]]$config = @("$(Resolve-Path .)","A.Module.Name.dll");
[int]$obflvl = $(Read-Host "Enter an obfuscation option [0-4]"); #0 - Level0 obf. debuggable, 1 - Level1 obf. debuggable-noil, 2 - Level2 obf. not debuggable, 3 - Level3 obf. not mergable, 4 - Level4 obf. not usable
$ops = @'
PHByb2plY3Qgb3V0cHV0RGlyPSJ7T1VURElSfSIgYmFzZURpcj0ie0JBU0VESVJ9IiBkZWJ1Zz0idHJ1ZSIgeG1sbnM9Imh0dHA6Ly9jb25mdXNlci5jb2RlcGxleC5jb20iPg0KICA8bW9kdWxlIHBhdGg9IntNT0RVTEV9Ij4NCiAgPHJ1bGUgcGF0dGVybj0idHJ1ZSIgaW5oZXJpdD0iZmFsc2UiIC8+DQogIDwvbW9kdWxl
Pg0KPC9wcm9qZWN0Pg==;
PHByb2plY3Qgb3V0cHV0RGlyPSJ7T1VURElSfSIgYmFzZURpcj0ie0JBU0VESVJ9IiBkZWJ1Zz0idHJ1ZSIgeG1sbnM9Imh0dHA6Ly9jb25mdXNlci5jb2RlcGxleC5jb20iPg0KICA8bW9kdWxlIHBhdGg9IntNT0RVTEV9Ij4NCiAgICA8cnVsZSBwYXR0ZXJuPSJ0cnVlIiBpbmhlcml0PSJmYWxzZSI+DQogICAgICA8cHJv
dGVjdGlvbiBpZD0iYW50aSBpbGRhc20iLz4NCiAgICA8L3J1bGU+DQogIDwvbW9kdWxlPg0KPC9wcm9qZWN0Pg==;
PHByb2plY3Qgb3V0cHV0RGlyPSJ7T1VURElSfSIgYmFzZURpcj0ie0JBU0VESVJ9IiB4bWxucz0iaHR0cDovL2NvbmZ1c2VyLmNvZGVwbG
@chrdek
chrdek / app.js
Created December 11, 2019 10:03
angular,bootstrap index
angular.module("MainContent",[]).controller("ProfileController",
function($scope,$http){
$scope.searchData = [{
"name":"Customer 1",
"description":"Default description"
},
{
"name":"Customer 2",
"description":"Description 2"
@chrdek
chrdek / ps-file-creation.ps1
Created September 15, 2019 16:04
Multiple ways to create a dummy file -of a specific size- in powershell command line
<#
#
#
# The scripts below (ranked fastest to slowest) are used to create a dummy file of
# varying sizes and of different contents. Null/Numeric/Binary data.
#
#
#>
# 1 - Using FileStreams
@chrdek
chrdek / node-sett.sh
Created April 13, 2019 15:08
Node sample regexp
#!/bin/bash
# Samples for Node set 1..
# ^(app\.js)|^(app\.[a-zA-Z0-9]+\.js)
ls | grep -E "app.[a-zA-Z0-9]+|app[0-9]{1,3}.js"
# ^(node_)[a-z0-9]+(.tmp)
ls | grep -E "node_[a-zA-Z0-9]+.tmp"
# %APPDATA%\npm-cache\_logs
@chrdek
chrdek / ps-sample.ps1
Last active March 7, 2019 21:31
Print terminal info, previous command runs in terminal cons.
rm "$HOME\Documents\outps.txt"
echo "Home Dir is ---> $HOME" >> "$HOME\Documents\outps.txt"
echo "Default Path is --> $PWD" >> "$HOME\Documents\outps.txt"
echo "Version is --> $BASH_VERSION (not running in ps)" >> "$HOME\Documents\outps.txt"
echo "Term type is --> $TERM (not running in ps)" >> "$HOME\Documents\outps.txt"
cat "$HOME\Documents\outps.txt"
powershell.exe cat "$HOME\Documents\outps.txt"
###########################################################################################
function ret1st() {
return "Last command was: "+$$;
@chrdek
chrdek / samplenums6.js
Created February 22, 2019 12:29
Sample numbers in string v6
f=v=>(d=v.map(c=>eval([...c].map(p=>p|0).join`+`)),d[0]==d[1])