Code Monkey home page Code Monkey logo

porno-_porn_blocker's Introduction

PorNo! Porn Blocker

PorNo! redirects users from porn to positive, fulfilling websites, instead of the standard "page blocked / blank screen" response


Chrome Extension Android App Join the Subreddit Additional Support
Get PorNo! Porn Blocker on Google Play Subreddit for PorNo!. r-slash-ourlastpornblocker Email me!

Contents

who what where when why how, goals of project (last porn blocker ever rawr)

Will PorNo! ever cost money?

mention problem with finding urls

Installation

HELP TRANSLATE PorNo!

add a gif for web and a gif for android

Note to self

Your problems with porn are not my issue.

Your welfare is not my priority.

I work on this project for my own amusement. 
I am not your friend.   

If there are ways to improve the software / issues with the software, I am 
 listening at [email protected] and the ourlastpornblocker Subreddit.

Thank you for your time.

Why?

March 2018, I was dealing with a break up off a nasty relationship, and I was using porn to feel less bad/pain/hurt/etc.

When I listened to my favorite music, I noticed I felt good off that. As music doesn't come with the dangers that porn use brings, I thought it would be cool if, whenever I went to a porn site (which was frequent during that time), I instead was shown my favorite music.

This technology didn't exist. I was in college studying computer science (and astronomy), and I thought I could try to build this kind of porn blocker.

The PorNo! Chrome Extension was released in July 2018. The PorNo! Android app was released in January 2019.

No. I don't need to explain myself.

If you're someone who wants to collaborate with the hopes of turning this into a business, however: in terms you'll understand, this segment of the market doesn't offer opportunity for a steady and lucrative income stream.

Additionally, the past, current, and future users of this idea have paid enough of a price with their time and lives.

Finally, I wouldn't like it if people looked at me as "a person who is comfortable taking money from people who have problems with porn."

(If you want to send me money anyways, you're welcome to sponsor this project or hit my Paypal directly. Thank you ๐Ÿ”ฅ)

How to use

  • See Installation for updating the lists
  • Download, deploy, visit a porn site, add a redirect site, visit a porn site.
  • Chrome
    • blahblah
  • Android
    • blah blah

Updating the lists

If you've modified lists/, apply your changes with ./generateLists.py or python generateLists.py in a terminal

This command will update chromeExtension/lists.js and androidApp/app/src/main/java/us/mrvivacio/porno/Domains.java

Release builds:

Chrome Extension

Click this or click the "Available in the Chrome Web Store" button at the top of the README

Android App

Click this or click the "Get it on Google Play" button at the top of the README

Developmental builds:

Chrome Extension

  1. Clone this repo to an easy-to-find place on your computer. For example, this bash command clones the repo to a folder called porNo in your Desktop:
 cd Desktop && git clone https://github.com/mrvivacious/PorNo-_Porn_Blocker.git porNo
  1. Enter chrome://extensions/ in the Google Chrome omnibox / search bar
  2. Turn on Developer mode in the top right corner of the window
  3. Click Load unpacked in the top left corner of the window
  4. Navigate to the folder you cloned PorNo and double-click the chromeExtension folder
  5. If successful, give yourself a pat on the back.

Android App:

  1. Same as above
  2. Open androidApp/ in Android Studio
  3. Read this
  4. NOTE: For Firebase stuff to work, you will need a google-services.json file (and probably need to create the project, create the database, etc)

Note: I don't have a magic CI/CD pipeline at the moment where y'all can recieve the latest changes to the repositories so just make sure you git pull regularly thx

  1. Fork this repository, button in top right of screen

  2. Download/clone your repo to your computer

  3. Download Android Studio

  4. Open androidApp/ in Android Studio

  5. Go to androidApp/app/src/main/res/values/strings.xml

  6. Do this

  7. Translate / Use Google Translate to copy the English text into the rows of the language you are translating for

  8. When finished, change your device language and run PorNo! (green triangle at top of studio) to verify there is no more English

  9. Git commit your changes and git push

  10. On the GitHub page for your fork, create a pull request for me to review your changes! (If these instructions aren't clear enough, dm me on Instagram @mrvivacious and let me know how I can improve them)

Features

Edit the URL lists

The websites are organized by the first letter of their domain name, in lists/Urls. There is a .txt file for the English alphanumeric alphabet, so 0-9, a-z.

Adding a site looks like opening its respective .txt file in a text editor. First check if the site is in the file with your text editor's search function. If the site isn't already in the file, type the name of the site at the top of the file then press enter to keep each site on its own line. Looking through the files will explain the format.

After the site is added, I like to use :sort in ViM to keep the txt file alphabetically sorted.

Finally, in the terminal, I run python generateLists.py. This script creates the JavaScript and Java files for the Chrome extension and the Android app, respectively, using the contents of the .txt files. You will see an output saying what files were updated along with their paths.

Add the lists and the updated .js and .java files to a Git commit and make a pull request. Thanks!

Filing issues / contributing

Todo

Contact me


Milestones

  • Created subreddit (June 26)

porno-_porn_blocker's People

Contributors

brettpatterson1 avatar eat616 avatar ghost2023 avatar ilidanrock avatar jaki-py avatar kiran-0001 avatar mrvivacious avatar realbj-dot avatar webverts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

porno-_porn_blocker's Issues

NSFW subreddits

Goal: Add the nsfw subreddits to PorNo! (note: this list of subreddits will 99.9999% grow in the future).

Strategy 1:
Copy paste everything from (you might want to open this in incognito...) here via console commands (please don't copy paste by hand, learn a bit of JavaScript and save the time).
This method will be effective at the beginning for an "initial grab of URLs" but is very time consuming in the long run (how will you know what links are new?)

Strat 2:
While this method will allow the subreddit to load some content, this is as "dynamic capture" as we can get.
Unless....you know of a way to scan DOM before page load?

Programmatically find the nsfw tag that NSFW subreddits keep in their "About" section.
If the subreddit has the nsfw tag:

  • Add the domain to the banlist (eventually push the list to the cloud database)
  • Redirect the user
window.onload = () => {
  let nsfwClassName = '_1wzhGvvafQFOWAyA157okr';

  // Reddit check
  // ! Elements dont load until after the page loads.
  if (domain === 'reddit.com') {
    if (document.getElementsByClassName(nsfwClassName).length) {
      window.stop();
      // ...and so on
    }
  }
}

Ability to report URLs from within PorNo!

Users have asked for personal safe/banlists...
PorNo! is only supposed to block porn, so for now Im more interested in implementing a "Report porn url" feature instead of custom filters. I'm curious what feedback users will give because im still open to the idea of custom lists...

Process, kind of:

Add a REPORT THIS SITE button next to the EMERGENCY button
onReportClicked() => currentURL is put in local banlist and added to firestore "REPORT suggestions" list

For now, I'll check the suggestions periodically and add em to the core lists if they are indeed porn sites and not like
a user wanted to block twitter or something so they "reported it" for their own benefit...tho this could be problematic cuz
the user would need the ability to edit and delete entries from their blocked list ugh

WAIT

onReportClicked => CurrentURL is sent to IBM api that checks category of site. 
isPorn ? redirect and update databases : do nothing

What about when the ibm api hits the limit every month?
Hmm good question I dont know lmao ugh i guess custom lists is the move to allow both user freedom while providing
developer flexibility for "finding new" URLs that need to be blocked.

o Add button
o Add logic to button
o Add interface to CRUD custom ban / safe lists (how are we even gonna ensure ppl dont put porn sites on safe lists though...ah, maybe a "report site as not porn button" idk w/e)
o Publish
o Awesome

Some refactoring

PorNo! is a URL-based porn blocker. As a result, PorNo! needs to get the URL of a website.

  1. Get the URL of a site
  2. Construct any additional URLs because some sites have curious NSWF hrefs (ie. hostname + path, for subreddits; "boards.4chan/abc123/")

Great, now we need to check that our URLs are porn sites (or not).

  1. Verify our URLs are in the database via pornMap[...]
  2. pornMap[...] ? redirect() : postWindowLoad() // tba

--

Just because a site isn't in our database doesn't immediately qualify the site as non-pornographic.

postWindowLoad() is a function that will parse the contents of a webpage after it loads. If the webpage seems NSFW, call a web category-checker API on that website for "official evaluation". (Also....add a way for users to report websites because they will surely encounter porn sites that should be blocked LOL).
Another issue will be opened for this at some point in the future.

IBM API locked -- find new web category API

The XFORCE api we were using now requires api keys for access -- before, we could just visit the url constructed and receive the desired data.

I would prefer a free to use API as opposed to having to pay for api calls should we ever reach X calls a month, so let's find some free web DB apis and implement those ^_^

Unflag baidu

Baidu is a search engine like Google -- let's put it on a safe list, not sure why it was blacklisted lol
Thx Ted

Java file generator

Write a script to generate the Java file with the list of URLs (and keywords, though I have no idea what we will do with the keywords at the moment...).
See java.py for current progress.

Why?
Code generators for the lists will make it a lot easier and faster to release list updates in the future:

  • JavaScript => Chrome Extension
  • Java => Android app
  • ??? => Your favorite environment

ipchicken.com false positive

ipchicken.com is just a webste that tells you your IP address. No porn here! but im not allowed to access
Thanks for this plugin its really great.

Potential Performance Improvements

As noted in the README, performance is a crucial element to the success of this application. This application also employs the use of large hard coded arrays. Due to the nature of the search, we can potentially implement a broad-phase for discarding obvious, non-matching urls.

Solution:
You can transform your list to have an array of websites indexed by the first character each url starts with. The transformation of this list would likely have to be done with a script or by hand, because we (assumedly) don't have the time to manipulate it during runtime.
ex:

[
     ["a", ["awebsite","anotherwebsite"]],
     ["b", ["bxxxxx","byyyy"]]
     ["c", ["c.dummyurl"]]
]

When determining if a string exists in the list, you may trim your potential matches significantly, by grabbing the list that corresponds to the first character in the url being checked.
In the above example, if we were checking the existence of the url "bzyz" in the list, we need only check the list ["bxxxxx","byyyy"]. This drastically improves our worst case scenario for url searches.

Disclaimer:
I have very limited knowledge of JS so the details of the implementation would be up to you, whether it's nested arrays or a hashmap. Ideally we could make use of a Trie, but the creation of such a datastructure with so many elements would cause more trouble than it's worth in such a small and runtime-oriented application.

Let me know if there's anything I can clarify,
Congrats on the release brother

xbabe.com bypasses PorNo! ??

Will have to test again later, was just surprised to see the site load after I "thought" this link was in the list...

cda.pl, biqle.ru

see now biqle.ru does serve porn without changing the url path -- as a result, i can't detect pornography unless i parse the webpage, but at that point is a bit too late
ill investigate biqle.ru at some point.

Great pull request: add code that can parse a webpage's content. If the page is determined to be pornographic / serving pornographic media, redirect from that page WITHOUT adding that domain to the list.

  • remove cda.pl from lists.js

Lists of porn sites

Found more lists:
https://block.energized.pro/extensions/porn-lite/formats/domains.txt
https://block.energized.pro/porn/formats/domains.txt
https://energized.pro/support/

--

Thoughts:
As the static lists keep growing, this will only take up more space on the release builds. Additionally, I think the chrome browser loads the extension's code from scratch each time you visit a website (no source, just from what I've seen on inline alert statement executions) and i wonder if adding more to the file size of the list will slow down chrome's loading of porNo chrome extension

Finding a way to dynamically capture a site is important, but right now i gotta get a nice and solid roadmap going to have something to focus on laisjflajfjiof

Update the Android detection

As a developer of a porn-blocking software that is used on Android devices at api level 15*,
I want to use the findAccessibilityNodeInfosByViewId (api level 18) to identify the user's current URL in addition to keeping the existing detection methods
So that we can keep the software functional for the margin of users on api15 while providing users at and above api18 a much better detection system.

Work description:

o Maintain the minLevelSDK or whatever flag in the gradle and elsewhere to api 15.
o Abstract the existing detection method to its own function and call this function as follows:

deviceApiLevel >= 18 ? use findAccessibilityNodeInfosByViewId : use existingDFSMethod

o Publish the update to Google Play

* = approximately 2.8% of PorNo! users. This statistic is subject to change, of course lol

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.