{"id":15415640,"url":"https://github.com/chrisrzhou/hackjs","last_synced_at":"2025-04-19T14:23:00.567Z","repository":{"id":57260155,"uuid":"327254694","full_name":"chrisrzhou/hackjs","owner":"chrisrzhou","description":"Functional programs for hacking in node","archived":false,"fork":false,"pushed_at":"2021-01-08T09:23:45.000Z","size":3430,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-02T03:37:04.721Z","etag":null,"topics":["ctf","fp","hacking","node","wargames"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chrisrzhou.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-06T08:56:48.000Z","updated_at":"2023-03-04T04:18:21.000Z","dependencies_parsed_at":"2022-08-25T02:42:07.421Z","dependency_job_id":null,"html_url":"https://github.com/chrisrzhou/hackjs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisrzhou%2Fhackjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisrzhou%2Fhackjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisrzhou%2Fhackjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisrzhou%2Fhackjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrisrzhou","download_url":"https://codeload.github.com/chrisrzhou/hackjs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249711487,"owners_count":21314250,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ctf","fp","hacking","node","wargames"],"created_at":"2024-10-01T17:09:10.546Z","updated_at":"2025-04-19T14:23:00.543Z","avatar_url":"https://github.com/chrisrzhou.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hackjs\n\nFunctional programs for hacking in node.\n\n---\n\n## Intro\n\nPrograms and solvers are written by the author to practice writing FP programs for hacking and solving CTFs ⛳️.\n\nPrograms are usually curried, which allows for composition and reuse, as shown in the examples below.\n\n## Use\n\nRequires at least `v13` Node to be installed.\n\nImport and alias to `h`\n\n```js\nimport * as h from 'hackjs';\n\n// pipe files\nconst flagRegexp = /flag{.*}/;\nh.pipeFile([\n  h.toString('utf8'),\n  h.lines,\n  h.filter(h.test(flagRegexp)),\n  h.head,\n  h.match(flagRegexp),\n  h.prop('match'),\n])('./leet.jpg'); // 'flag{1337}'\n\n// modular ciphers\nconst rot13 = h.caesarCipher(13);\nrot13('synt{1337}'); // 'FLAG{1337}'\n\nh.substitutionCipher(h.MORSE_CODE_MAPPING)('..-. .-.. .- --. { .---- ...-- ...-- --... }'); // 'flag{1337}'\n\n// string conversions by recoding bases\nconst decToBinary = recode(16)(2);\nrecode(16)(10)('a'); // hexadecimal to decimal (10)\nrecode(16)(8)('a'); // hexadecimal to octal (12)\nrecode(8)(16)(12); // octal to hex ('a')\ndecToBinary('a'); // hexadecimal to binary ('1010)\n```\n\nOr import specific named methods\n\n```js\nimport { lines, map, pipe, toUpper, tap } from 'hackjs';\n\npipe([\n  lines,\n  tap('after lines'), // 'tap' the pipe to print the state after an executed program\n  map(toUpper),\n  tap('after uppercase'),\n])('l1w1 l1w2 l1w3\\nl2w1 l2w2 l2w3'); // ['L1W1 L1W2 L1W3', 'L2W1 L2W2 L2W3']\n```\n\n## CTFs\n\nCTFs are solved using `h` programs.\n\nSolved CTFs are organized in the [`ctf`](./ctf) folder and can be executed via `node`.\n\n```bash\ncd ctf/my-ctf\nnode index.mjs\n```\n\n## Test\n\nRun tests with `npm test`.\n\n## TODOs\n- Expand `file` programs.\n- Implement a [steganography decoder](https://stylesuxx.github.io/steganography/)\n- Implement a [Vigenere autosolver](https://www.guballa.de/vigenere-solver)\n\n## Resources\n- [CTF](https://en.wikipedia.org/wiki/Wargame_(hacking))\n- [`sanctuary`](https://github.com/sanctuary-js/sanctuary)\n- [`tape`](https://github.com/substack/tape)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisrzhou%2Fhackjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrisrzhou%2Fhackjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisrzhou%2Fhackjs/lists"}