OpenWrt Advertisement implantation Prototype build

Source: Internet
Author: User
First step: Prepare the firmware

Compiling openwrt firmware-select Privoxy

Configure User.filter, user.action, config files.

Config file to specify the listener address and port number

[cpp]  View Plain  copy root@yswifi:/etc/privoxy# cat config    confdir / etc/privoxy   logdir /var/log   filterfile default.filter   Filterfile  user.filter   #logfile  privoxy   actionsfile match-all.action #  actions that are applied to all sites and maybe overruled  later on.   Actionsfile default.action   # main actions file    actionsfile user.action      # user customizations    listen-address  10.1.1.1:8118   toggle  1   enable-remote-toggle  1   enable-remote-http-toggle  0   enable-edit-actions 1   enforce-blocks 0   buffer-limit 4096   Forwarded-connect-retries  0   accept-intercepted-requests 1   allow-cgi-request-crunching 0   split-large-forms 0   keep-alive-timeout 300   socket-timeout 300   permit-access  10.1.1.0/24   Debug   1    # show  each GET/POST/CONNECT request   debug   4096 # startup  banner and warnings   debug   8192 # errors - *we  highly recommended enabling this*   #admin-address privoxy-admin@example.com    #proxy-info-url http://www.example.com/proxy-service.html      Root@yswifi :/etc/privoxy#   

Inject ad script into the user.action xxx.js

Specific reference to my script Https://gist.github.com/qianguozheng

Add Filter rule in User.filter

1. Filter:block-weeds
2. S|

Call Filter Rule in user.action
1. {+filter{block-weeds}}
2. *


Go to port 8118 for all destination port 80 requests
1. Iptables-t nat-a prerouting-s 0.0.0.0/0.0.0.0-p tcp--dport 80-j REDIRECT--to-ports 8118

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.