{"id":19589170,"url":"https://github.com/fasttime/jscrewit","last_synced_at":"2025-05-16T09:04:37.773Z","repository":{"id":18078851,"uuid":"21142168","full_name":"fasttime/JScrewIt","owner":"fasttime","description":"Write any JavaScript with six characters: ! ( ) + [ ]","archived":false,"fork":false,"pushed_at":"2025-05-01T08:16:07.000Z","size":7829,"stargazers_count":175,"open_issues_count":17,"forks_count":13,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-05-16T09:04:34.485Z","etag":null,"topics":["esoteric","jsfuck","obfuscation"],"latest_commit_sha":null,"homepage":"https://jscrew.it","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fasttime.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-06-23T20:59:57.000Z","updated_at":"2025-05-01T08:16:11.000Z","dependencies_parsed_at":"2024-06-18T21:11:45.554Z","dependency_job_id":"35d3d30b-5e22-41a9-bb75-4512a1703d0b","html_url":"https://github.com/fasttime/JScrewIt","commit_stats":{"total_commits":1616,"total_committers":11,"mean_commits":146.9090909090909,"dds":"0.20049504950495045","last_synced_commit":"67ec2ec198a3bc11875b243b34614a19213e703d"},"previous_names":[],"tags_count":99,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fasttime%2FJScrewIt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fasttime%2FJScrewIt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fasttime%2FJScrewIt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fasttime%2FJScrewIt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fasttime","download_url":"https://codeload.github.com/fasttime/JScrewIt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254501557,"owners_count":22081528,"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":["esoteric","jsfuck","obfuscation"],"created_at":"2024-11-11T08:17:30.465Z","updated_at":"2025-05-16T09:04:35.205Z","avatar_url":"https://github.com/fasttime.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JScrewIt · [![npm version][npm badge]][npm url]\n\nUse **JScrewIt** to convert your JavaScript code into\n[JSFuck](https://en.wikipedia.org/wiki/JSFuck).\nJSFuck is an encoding technique that uses only the six characters `!` `(` `)` `+` `[` `]` to produce\nsyntactically correct JavaScript that can still run in a browser or another JavaScript engine\nwithout any additional software.\n\nPlay now with [**jscrew.it**](https://jscrew.it), or give a look at\n[jQuery *Screwed*](https://github.com/fasttime/jquery-screwed) for a true example: a working version\nof jQuery consisting of only six different characters.\n\nJScrewIt was born as a fork of [aemkei's JSFuck](https://github.com/aemkei/jsfuck) and has developed\ninto one of the most powerful JSFuck encoders on the web, including a number of unique features.\n* Options to optimize code for a particular set of JavaScript engines or even just for your browser:\n  the more specific your engine choice, the shorter the code you'll get.\n* Support for all modern JavaScript engines (and a few older ones, too).\n* Neatly optimized large file encoding.\n* Encode-as-you-type browser interface.\n\n### Example\n\nThe following source will do an `alert(1)` in any browser, including Internet Explorer:\n\n```\n[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[])[+[]]+\n(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]][([+[![]]]+!!++([]+[][(![]+[])[+[]]+(\n[![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[!![]+!![\n]+!![]]+(!![]+[])[+!![]]])[+[]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![\n]+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]])[+!!\n[]+[+!![]]]+(!!++([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+\n!![]]+(!![]+[])[+[]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]])[+[]]+[][(![]+[\n])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[])\n[!![]+!![]+!![]]+(!![]+[])[+!![]]])[+!![]+[+!![]]]+([][[]]+[])[+!![]]+(![]+[])[!\n![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([+[![]]]+!!++([\n]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[])[+[]\n]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]])[+[]]+[][(![]+[])[+[]]+([![]]+[][[\n]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[!![]+!![]+!![]]+(!\n![]+[])[+!![]]])[+!![]+[+!![]]]+(!![]+[])[+[]]+(!!++([]+[][(![]+[])[+[]]+([![]]+\n[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[!![]+!![]+!![]\n]+(!![]+[])[+!![]]])[+[]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[\n!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]])[+!![]+[+!\n![]]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]\n]+([][[]]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+!![]]+(+[]+[+[]]+[][(![]+[])[+[\n]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[!![]\n+!![]+!![]]+(!![]+[])[+!![]]])[+!![]+[+!!++([]+[][(![]+[])[+[]]+([![]]+[][[]])[+\n!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[\n])[+!![]]])[+[]]]]+(![]+[])[+!![]]+(![]+[])[!![]+!![]]+(!![]+[])[!![]+!![]+!![]]\n+(!![]+[])[+!![]]+(!![]+[])[+[]])()(+!![])\n```\n\n## Setup Instructions\n\n### In the Browser\n\nTo use JScrewIt in your project, download\n[jscrewit.js](https://cdn.jsdelivr.net/npm/jscrewit/lib/jscrewit.js) (uncompressed, development\nversion) or\n[jscrewit.min.js](https://cdn.jsdelivr.net/npm/jscrewit/lib/jscrewit.min.js) (compressed, productive\nversion) from npm and include it in your HTML file.\n\n```html\n\u003cscript src=\"jscrewit.js\"\u003e\u003c/script\u003e\n```\n\nAlternatively, just hotlink the latest version on npm using a CDN of your choice.\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/jscrewit\"\u003e\u003c/script\u003e\n```\n\n### In Node.js\n\nIf you are using Node.js, you can install JScrewIt with [npm](https://www.npmjs.org).\n\n```console\nnpm install jscrewit\n```\n\nThen you can import it in your code in the usual way.\n\n```js\nimport JScrewIt from \"jscrewit\"; // ECMAScript module syntax\n```\nor\n```js\nconst JScrewIt = require(\"jscrewit\"); // CommonJS syntax\n```\n\nJScrewIt comes with bundled TypeScript declarations: you can use it in TypeScript without installing\nany additional packages.\n\n## Usage\n\n### Basics\n\nThis will encode the `alert(1)` example shown above and run it using `eval`.\n\n```js\nconst output = JScrewIt.encode(\"alert(1)\");\neval(output);\n```\n\nTo encode just a plain string rather than an executable script, enclose the text in double or simple\nquotes, like when introducing a string literal in JavaScript code.\n\n```js\nconst output = JScrewIt.encode(\"'Hello, world!'\");\nconst input = eval(output); // input contains the string \"Hello, world!\".\n```\n\nWe can also use escape sequences to encode newlines and other characters.\nNote that the initial backslash in an escape sequence must be escaped with another backslash when\nwriting a \"sting in a string\".\n\n\n```js\nconst output = JScrewIt.encode(\"\\\"1.\\\\n2.\\\\n\\\\u263A\\\"\");\n/*\n1.\n2.\n☺\n*/\n```\n\n`JScrewIt.encode` also accepts an optional second parameter containing options that control various\naspects of the encoding.\nThese are covered in detail in the [relative section](api-doc/interfaces/EncodeOptions.md) in the\nAPI Reference.\n\n### Features\n\nOne peculiarity of JScrewIt is the ability to generate JSFuck code that is customized for a\nparticular set of JavaScript engines (web browsers or Node.js).\nThis optimized code is shorter than generic JSFuck code but does not work everywhere.\nTo make use of this optimization, we have to specify which *features* the decoder engine is expected\nto support.\n\nIn order to understand how this works, let's consider the JavaScript functions `atob` and `btoa`.\nNot all browsers support these functions: without any further information, JScrewIt will assume that\nthey are unavailable and will not use them to encode the input.\nHowever, if we know in advance that the browsers we plan to target do support `atob` and `btoa`, we\ncan let JScrewIt create code that uses those functions whenever that makes the output shorter.\n\nThe way to tell JScrewIt to use a particular set of features is by specifying a value for the\n`features` option in the second parameter passed to `encode`.\n\nFor instance, a generic `alert(1)` example for an unspecified environment is 1903 chracters long.\n\n```js\nconst output = JScrewIt.encode(\"alert(1)\"); // output is 1903 characters\n```\n\nWe can save a few characters by indicating that our code is only supposed to run in a browser.\nWe do this using the feature [`BROWSER`](api-doc/interfaces/FeatureAll.md#BROWSER).\n\n```js\nconst options = { features: \"BROWSER\" };\nconst output = JScrewIt.encode(\"alert(1)\", options); // 1882 characters\n```\n\nBut if we are only interested in code that runs in an up to date Firefox browser, the output length\nshrinks to about one third:\n```js\nconst options = { features: \"FF\" };\nconst output = JScrewIt.encode(\"alert(1)\", options); // 655 characters now\n```\n\nHere we have used another feature: [`FF`](api-doc/interfaces/FeatureAll.md#FF).\nThis feature produces the shortest possible code that runs in current Firefox browsers.\n\nWe can specify more than one feature using an array, e.g.\n```js\nconst input = \"document.body.style.background='red'\";\nconst options = { features: [\"ATOB\", \"WINDOW\"] };\nconst output = JScrewIt.encode(input, options);\n```\n\nAs opposed to the previous example, the features specified here refer to certain abilities that may\nbe supported by more than one particular class of browsers or JavaScript engines.\nSpecifically, [`ATOB`](api-doc/interfaces/FeatureAll.md#ATOB) indicates native support for the\nfunctions `atob` and `btoa`, while [`WINDOW`](api-doc/interfaces/FeatureAll.md#WINDOW) refers to a\nparticular string representation of the global object `self`, where available.\nThe code generated by JScrewIt will run fine in engines that support both of these features.\nIn engines that don't support both features, the code may not work, and may produce unpredictable\nresults.\nMost typically, it will throw some kind of error at runtime.\n\nIt's important to keep in mind that each of the target engines needs to support every feature we\nspecify.\nSo if we want our JSFuck code to run in Android Browser 4.0, Safari 7.0 and Node.js 13+, we can only\nspecify features supported by all of these engines.\nThese features can be retrieved with\n[`JScrewIt.Feature.commonOf`](api-doc/interfaces/FeatureConstructor.md#commonof).\n\n```js\n{ features: JScrewIt.Feature.commonOf(\"ANDRO_4_0\", \"NODE_13\", \"SAFARI_7_0\") }\n```\n\nThe features turn out to be\n[`ESC_HTML_QUOT`](api-doc/interfaces/FeatureAll.md#ESC_HTML_QUOT),\n[`GMT`](api-doc/interfaces/FeatureAll.md#GMT),\n[`INCR_CHAR`](api-doc/interfaces/FeatureAll.md#INCR_CHAR),\n[`NAME`](api-doc/interfaces/FeatureAll.md#NAME) and\n[`NO_IE_SRC`](api-doc/interfaces/FeatureAll.md#NO_IE_SRC) (a quick way to see this is entering\n`JScrewIt.Feature.commonOf(\"ANDRO_4_0\", \"NODE_13\", \"SAFARI_7_0\").toString()` in the browser's\nconsole).\nWith this knowledge, we could also rewrite the expression above as follows.\n\n```js\n{ features: [\"ESC_HTML_QUOT\", \"GMT\", \"INCR_CHAR\", \"NAME\", \"NO_IE_SRC\"] }\n```\n\nFinally, note that simply specifying an array of engine features will not achieve the desired\neffect, as it will result in the union of the features available in every engine rather than in\ntheir intersection.\n\n```diff\n- { features: [\"ANDRO_4_0\", \"NODE_13\", \"SAFARI_7_0\"] }\n```\n\n### Further Reading\n\n* [API Reference](api-doc/README.md)\n* [Feature Reference](Features.md)\n\n## Compatibility\n\nJScrewIt itself and the code it generates are compatible with the JavaScript engines listed below.\n\n ![Chrome](https://api.iconify.design/mdi:google-chrome.svg) Chrome 122+\n\u003cbr\u003e\n ![Safari](https://api.iconify.design/mdi:apple-safari.svg) Safari 7.0+\n\u003cbr\u003e\n ![Edge](https://api.iconify.design/mdi:microsoft-edge.svg) Edge 122+\n\u003cbr\u003e\n ![Firefox](https://api.iconify.design/mdi:firefox.svg) Firefox 90+\n\u003cbr\u003e\n ![Opera](https://api.iconify.design/mdi:opera.svg) Opera 108+\n\u003cbr\u003e\n ![Internet Explorer](https://api.iconify.design/mdi:microsoft-internet-explorer.svg) Internet\nExplorer 9+\n\u003cbr\u003e\n ![Android Browser](https://api.iconify.design/mdi:android.svg) Android Browser 4.x\n\u003cbr\u003e\n ![Node.js](https://api.iconify.design/mdi:nodejs.svg) Node.js (all versions)\n\n### Engine Support Policy\n\nOnly the most recent stable version of Chrome, Edge, Firefox and Opera are guaranteed to be\nsupported at any time, as detailed below.\n- Chrome: (Current - 1) and Current\n- Edge: (Current - 1) and Current\n- Firefox: (Current - 1) and Current, ESR\n- Opera: Current\n\nExpect compatibility with these browsers to change in future releases of JScrewIt, while the current\nbrowser versions become replaced by newer ones.\n\nCompatibility with older versions of Internet Explorer, Safari, Android Browser and Node.js is\nstable and not expected to change until the next major release of JScrewIt.\n\n### Known Limitations\n\nDespite claims from other sources, not every piece of JavaScript can be converted into JSFuck.\nSome intrinsic limitations of the language make the code generated by JScrewIt unusable under\ncertain conditions.\n\n#### Modules\n\nJScrewIt is designed to encode JavaScript scripts, as opposed to\n[modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules).\nMany module related features don't work at all in JSFuck: `import` and `export` statements in\nEcmaScript modules or usages of the `require` API in CommonJS modules cannot be encoded and are not\nsupported.\n\n#### Altered Global Objects\n\nJavaScript libraries that manipulate global objects and functions can easily break the code\ngenerated by JScrewIt.\nThere are many of them, so expect incompatibilities when working with third party tools.\n\n#### Stack Trace Inspection\n\nStack traces thrown in encoded source files look different and may as well include frames not\nexpected by the original code.\nFor this reason, code that relies on stack trace inspection may no longer work after being\nconverted.\n\n## Interesting Links\n\n* [JScrewIt](https://jscrew.it) online encoder\n* [JSFuck](https://en.wikipedia.org/wiki/JSFuck) on Wikipedia\n* [JSFuck](https://esolangs.org/wiki/JSFuck) on Esolang\n* [jsfuck.com](http://www.jsfuck.com)\n* [jQuery *Screwed*](https://github.com/fasttime/jquery-screwed)\n\n[npm badge]: https://img.shields.io/npm/v/jscrewit?logo=npm\n[npm url]: https://www.npmjs.com/package/jscrewit\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffasttime%2Fjscrewit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffasttime%2Fjscrewit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffasttime%2Fjscrewit/lists"}