Openwrt ad implantation prototype construction

Source: Internet
Author: User

By setting up a provioxy proxy server on the vro, the author filters the webpage through it and embeds corresponding ads.

If you don't talk nonsense, go directly to the experiment:


Step 1: Prepare the firmware

Compile openwrt firmware-select Privoxy


Step 2: modify the configuration file

Configure the user. filter, user. Action, and config files.

In the config file, you must specify the listening address and port number.

[email protected]:/etc/privoxy# cat config confdir /etc/privoxylogdir /var/logfilterfile default.filterfilterfile user.filter#logfile privoxyactionsfile match-all.action # Actions that are applied to all sites and maybe overruled later on.actionsfile default.action   # Main actions fileactionsfile user.action      # User customizationslisten-address  10.1.1.1:8118toggle  1enable-remote-toggle  1enable-remote-http-toggle  0enable-edit-actions 1enforce-blocks 0buffer-limit 4096forwarded-connect-retries  0accept-intercepted-requests 1allow-cgi-request-crunching 0split-large-forms 0keep-alive-timeout 300socket-timeout 300permit-access  10.1.1.0/24debug   1    # show each GET/POST/CONNECT requestdebug   4096 # Startup banner and warningsdebug   8192 # Errors - *we highly recommended enabling this*#admin-address [email protected]#proxy-info-url http://www.example.com/proxy-service.html[email protected]:/etc/privoxy# 

Inject the advertisement script XXX. js into user. Action

See my script https://gist.github.com/qianguozheng for details

Add filter rules in user. Filter

FILTER: block-weedss|
User. Action
{+filter{block-weeds}}.*

Forward all requests whose target address is port 80 to port 8118
iptables -t nat -A PREROUTING -s 0.0.0.0/0.0.0.0 -p tcp --dport 80 -j REDIRECT --to-ports 8118


Step 3: experience the results

At this time, when you open the web page, you will find that the world is so easy to control, every web page has what you want to see.

Openwrt ad implantation prototype construction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.