{"id":23853835,"url":"https://github.com/py7hon/linkshim","last_synced_at":"2026-06-17T18:06:13.960Z","repository":{"id":104199447,"uuid":"135118630","full_name":"py7hon/LinkShim","owner":"py7hon","description":"l.facebook.com clone ","archived":false,"fork":false,"pushed_at":"2023-12-15T02:15:02.000Z","size":8,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-22T07:57:04.368Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/py7hon.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-28T06:28:22.000Z","updated_at":"2018-06-17T01:37:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"82c00726-4f47-4686-a25d-e9d34f028b1b","html_url":"https://github.com/py7hon/LinkShim","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/py7hon/LinkShim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py7hon%2FLinkShim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py7hon%2FLinkShim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py7hon%2FLinkShim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py7hon%2FLinkShim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/py7hon","download_url":"https://codeload.github.com/py7hon/LinkShim/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py7hon%2FLinkShim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34459720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-01-02T23:33:21.388Z","updated_at":"2026-06-17T18:06:13.932Z","avatar_url":"https://github.com/py7hon.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Notice:\n======\nThis is a proof of concept, and not a production-ready script. Use it as a reference.\n\n\nLinkShim\n========\n\nReplicates Facebook Functionality of their LinkShim\n\nWhen you click on a link on Facebook to an external url, they take you to a script on Facebook that redirects you to link you requested. This is an important security feature, for the following reasons:\n\n### Protects People\nCreates opportunity to stop malicious and spammy sites in real-time.\n\n### Protect Privacy\nWebsites know where you came from by the referrer attribute in the header. On most pages, this might not be an issue. But if I clicked on a link that was on my profile, the website could glean the fact that my facebook user\nname is \"iqbalrifaii\" because my referrer would be \"http://www.facebook.com/iqbalrifaii\". But when we use a redirect script, the referrer is simply \"http://www.facebook.com/l.php\"\n\n### Gather Analytics\nA successful web company should know what's be linked to, shared by who, clicked by who, trends, etc. A redirect script creates that opportunity.\n\n\n### Learn More About Facebook's (\u0026 thus this) LinkShim\nMatt Jones, an engineer at Facebook, wrote an excellent explanation of their LinkShim\nhttps://www.facebook.com/note.php?note_id=10150492832835766\n\nHow to Setup\n========\nThis project is meant to be a framework you can use to quickly set a LinkShim. Thus, it is not comprehensive (for example, there is no user specific logging, which would be necessary in production). Follow these steps to setup:\n\n### 1. Install Redis \u0026 Tornado\nLinkShim uses [Redis](http://redis.io), a [NoSQL](http://en.wikipedia.org/wiki/NoSQL) technology, to maintain a spam watchlist, an analytics container, and a set of valid hashes to prevent becoming an [OpenRedirector](https://www.owasp.org/index.php/Open_redirect)\n\nIt also uses the python (Tornado Framework)[http://www.tornadoweb.org/], a scalable, non-blocking web server. I implemented this in python rather than PHP so we can keep settings and database connections open between calls. In redirect engines, speed is of utmost importantance (behind security, of course.)\n\n### 2. Change Settings\nDownload these files, place them where you want, and open server.py. Change the `admin_token` to something random/secure, and `listen_on_port` to the port you want to listen to, and templates_dir to the absolute path of your templates. (duh.)\n\n### 3. Start er' Up.\n`python server.py` will work for testing. In production, you'll want to use a daemon.\n\n### 4. Create some Hashes\nHave your frontend guys/gals hit `/hash?admin_token=YOUR_TOKEN\u0026num=10` to create some hashes when they need them. By Default, tokens are valid for 6 hours. This endpoint should really be only avaiable internally for security reasons. It's on the same port for now just for the demo. \n\n### 5. Include the JS and place the Hashes\nInclude the JS Script on your page. Place one of the hashes in JS like so:\n\n```javascript\n\u003cscript type=\"text/javascript\"\u003e\n  LinkShim.init();\n  \t\n  LinkShim.addPageParams({\n    pageVersion: 'a',//great for A/B testing!\n    hash: 'CREATED_HASH',\n    anyRandomPageVar: '3000'\n  });\n\t\t\n\u003c/ script \u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpy7hon%2Flinkshim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpy7hon%2Flinkshim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpy7hon%2Flinkshim/lists"}