上校
- 注册时间
- 2009-10-11
- 金币
- 14196 个
- 威望
- 2 个
- 荣誉
- 1 个
累计签到:1700 天 连续签到:1 天 [LV.1825]无线元老
|
本帖最后由 476867546 于 2016-3-10 17:33 编辑 ; x2 Q! Z0 d7 u+ h3 f
* N% g `+ V# b Openwrt 无线路由器搭建php服务器实现钓鱼.
& o( e* e6 {0 |! e* t6 V+ g3 A( V 本人也是小白,都是在网上找的资料.已成功搭建钓鱼环境,现分享给大家.教程只演示不带USB口的.#无线路由器刷Openwrt要求16M闪存.带USB接口或不带都行(带的网址放U盘里.不带的放路由器目录里)
y( ]6 ?0 ~6 ]+ {/ a/ u5 e0 T6 c
准备工作:# l+ s5 f( { ` @8 q
winSCP连接路由在/www下建立一个sda/www文件夹
( z8 F2 X: n$ P2 U% ~' U; Y) U) g, _+ m8 I! h+ T
1.安装nginx+php+mysql6 c. B/ E; O4 b( f- ~
" o l2 @) s5 Z! ]- d I
进路由里修改openwrt安装源如下:
4 V) _4 u- R, }5 cdest root /
" j/ V& _/ f% D1 Ydest ram /tmp
4 R( w( K6 J& m0 b P4 h3 ~3 x9 Q# q% Klists_dir ext /var/opkg-lists
3 M$ |" K( X& C6 \2 E3 Boption overlay_root /overlay
U+ ]! N( r5 `/ Nsrc/gz chaos_calmer_base http://downloads.openwrt.org/cha ... neric/packages/base
* |7 s. e& `. [: R' r8 C; ]$ esrc/gz chaos_calmer_packages http://downloads.openwrt.org/cha ... c/packages/packages
: `; U& Q! Q9 I y' Nsrc/gz chaos_calmer_routing http://downloads.openwrt.org/cha ... ic/packages/routing6 B1 A' w0 r3 A/ z2 |2 U& b
src/gz chaos_calmer_telephony http://downloads.openwrt.org/cha ... /packages/telephony4 m' M. F! H3 J; u: `8 E
src/gz chaos_calmer_management http://downloads.openwrt.org/cha ... packages/management
& i- y- Z: s& @" e" T打开putty终端更新并安装软件.
& X E& _% C# y6 }( [' _opkg update% }. J) d4 f# \" N. |2 m, i X& [/ a
opkg install php5 php5-mod-gd php5-mod-session php5-mod-pdo php5-mod-pdo-mysql php5-mod-mysql php5-mod-mcrypt php5-mod-mbstring php5-fastcgi php5-cgi php5-mod-xml php5-mod-ctype php5-mod-curl php5-mod-exif php5-mod-ftp php5-mod-iconv php5-mod-json php5-mod-sockets php5-mod-sqlite3 php5-mod-tokenizer php5-mod-zip7 Y& t9 Z- K% h- l6 _
1 e6 y# a' b0 ^- d. I* o+ y
opkg install mysql-server 3 y' R( v% Q. R
' `( N9 Z9 F( r
opkg install nginx spawn-fcgi zoneinfo-core zoneinfo-asia& o& r" a8 w/ q, m- W. S" W# @
4 d a: E Q. Q- ~7 e3 Y
opkg install shadow-groupadd shadow-useradd9 ?% I& W! X* f' b
( S: h2 z( c0 I7 W. Igroupadd www
2 \" l: y: z; `* R# h" p
' F2 J% b0 ^& |2 x3 m+ ouseradd -g www www
; S; {4 n! a. h* `) M9 T# G* z- s
chown -R www:www /www/sda/www重启!4 f8 T0 d5 ~6 W# b' S6 Y
winSCP连接路由修改/etc/my.cnf(改掉这两段)
" ^7 b$ ]9 j l" s& Ndatadir = /www/sda/data/mysql/* l. ?: U8 |- M* J
tmpdir = /www/sda/data/tmp/
O3 G2 ]# f* O6 U! f- H% H: w( N
4 v' x9 _+ w! D4 x) P2 ?+ _% `- _# p& ^5 e
创建数据库文件夹 x+ h9 |7 ?- S& H, _
mkdir -p /www/sda/data /www/sda/data/mysql /www/sda/data/tmp3 X8 |( Y5 K* C0 _% G4 {5 ?( e
' s2 X4 ?6 {3 F M创建默认的数据库! `! Q6 F. F9 ]3 b2 `
/usr/bin/mysql_install_db --force, C, P, O/ S) [2 ?3 w) Q0 L
8 w# V. k# m0 u& Y
启动mysql
% g/ ` ?& c/ K+ X( A. H0 L, ?/etc/init.d/mysqld start
" M' `, { f7 Z输入如下命令创建mysql的密码
& i. S. W ?% f5 D! w4 s/usr/bin/mysqladmin -u root password 123456( T' t/ h5 p( W: Z) m- h v( I
登陆数据库
/ X' E+ d$ ?' w$ _ @mysql -u root -p
& d4 J( p/ G: W) R4 r! _8 K$ P3 c
" L: j6 e" V; A$ f$ \- ^" u修改/etc/nginx/nginx.conf
- M, q/ ]5 d' E2 q& Y7 ]user www www;/ U2 D4 Z$ D# F' E! `' R
worker_processes 1;, n; n) v2 q: u. t
pid /var/run/nginx.pid;
5 v) h' [/ ]# `; j O2 _error_log /var/log/nginx_error.log; r2 n$ _/ y K: u- u
events {
$ I$ W8 n4 V1 [7 | u8 Y use epoll;
6 i! b& X2 K& Z4 d% T2 V* j worker_connections 1024;
: f: P' c: s$ |& c) [2 J2 q}, Q0 p& k% ^3 D l! M7 R
! I0 d( m8 |0 o. p
. c8 N& p6 P% c6 M
http {( E3 J3 X7 p) l* K+ ]0 L4 p
include mime.types;
2 ^! r! c$ W1 `0 x4 s0 ? default_type application/octet-stream;3 I9 T: C D- o+ F
sendfile on;2 m- q' W: B, T: i
tcp_nopush on;4 B- X# l: P5 T, Y3 C6 k
#keepalive_timeout 0;. U* h& ?% P# ?. G- V. z
keepalive_timeout 65;8 }5 `7 k- z, e! P4 V
gzip on;" _/ P6 |7 P8 M* y0 W
access_log off;
$ F& Y3 O0 n [( V0 d# T5 s
. |6 p# V( J! z: O: R8 {9 @ include vhost.conf;
- U r& t: n1 @1 t( U7 t} N) M& F& _) h+ D/ Z
) O9 z8 l8 M& v7 M
修改/etc/nginx/fastcgi_params
$ j% s# Q# Y' j: l6 Q9 Eif ($request_filename ~* (.*)\.php) {
- X0 H8 ]: u Y: B7 K% E set $php_url $1;; k+ `) J) R: w* y
}
5 V& I& ^* p" ^, n3 \if (!-e $php_url.php) {
3 K" r3 f; a. f# P6 C return 403;- Z! O2 w9 e& d: }' }
}* A2 b$ ?8 f8 ? h5 t
v; D! ^& @! H! |/ H# v8 I d; W) I% k6 M
fastcgi_param QUERY_STRING $query_string;" ~+ t3 m! l; M% \ Y3 E) |
fastcgi_param REQUEST_METHOD $request_method; j0 d- s0 ]9 J% r! s' B3 q
fastcgi_param CONTENT_TYPE $content_type;3 G ^4 o" s2 ?" x3 ~8 M/ }
fastcgi_param CONTENT_LENGTH $content_length;! a9 b$ Q1 ~4 ], V2 P3 y
+ `3 K: R, X; V2 \" [8 M
8 R" t3 F: L6 _5 R; _" D/ {5 g: ~8 Xfastcgi_param SCRIPT_NAME $fastcgi_script_name;
( o% A, i' c- E3 {: }fastcgi_param REQUEST_URI $request_uri;
4 g7 e8 Q, e$ w* s% i" `2 [fastcgi_param DOCUMENT_URI $document_uri;
0 z$ G+ V2 P$ F: efastcgi_param DOCUMENT_ROOT $document_root;- B* v7 {6 H w
fastcgi_param SERVER_PROTOCOL $server_protocol;# B! \/ Q4 B0 @8 ^
* Q! M- p& {& Z6 ^
# s C3 w q0 k; Ufastcgi_param GATEWAY_INTERFACE CGI/1.1;
6 f- L* U$ T7 u1 V; D, L# \# sfastcgi_param SERVER_SOFTWARE nginx/$nginx_version;: }8 M" w4 N: x
6 R' w6 f2 |* x4 L; c0 d; [! u7 T, a7 e- K* j1 H
fastcgi_param REMOTE_ADDR $remote_addr;5 j3 q& U) c0 g
fastcgi_param REMOTE_PORT $remote_port;
; p, y+ K) ]+ x5 O* o( W: [fastcgi_param SERVER_ADDR $server_addr;( T0 Z8 ~. n8 c1 Y3 @% a5 j
fastcgi_param SERVER_PORT $server_port;
) ~% S9 Z. {0 v& U. @( \fastcgi_param SERVER_NAME $server_name;7 G! V: ?& W) ^, }1 G# t+ Q7 D
' h* v0 K! ]' p# g! S, m6 F0 b7 S& e0 d+ p
# PHP only, required if PHP was built with --enable-force-cgi-redirect
6 X! R5 `& p: l" Ffastcgi_param REDIRECT_STATUS 200;5 H0 B3 z5 R7 ^, x
$ T- m; |: J- _! I
添加文件/etc/nginx/vhost.conf3 l Z" w: e# [) `
server {; r; v$ h' Z7 `3 }) s, I! W0 C
listen 8000;1 I0 O: v N( m- K: _6 r( F
server_name localhost;/ D4 x- a% p# r! w" ?4 R+ F
root /www/sda/www;0 g1 U% K9 H9 h: ?) I
index index.html index.htm index.php default.php;
: V6 r* \. C/ q0 g* A6 t8 b error_page 500 502 503 504 /50x.html;
' u& e o9 C5 D5 _+ l. l2 R: X1 N/ L! d# u& W- i# f {
6 `( P' K3 Y) {4 u location = /50x.html {
% @+ ^1 `- t8 s; q root html;
; }$ a$ l i# z9 f8 ^ }
6 W# V6 ^; J! ]0 O& |* f7 A0 D, Q! R( E o+ A
$ F$ U# g9 N: l5 Q, d location ~* ^.+\.php(\/.*)*$ {1 w& }1 e% m$ b8 `% W
fastcgi_pass 127.0.0.1:9000;' I+ J. a( I. I5 Y! b z3 y' G
fastcgi_index index.php;( t+ r O! [6 x8 V, n
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;1 X- ?+ h+ s* s# q( E0 Y+ @, l
include fastcgi_params;
7 z9 y r' r4 Y/ A! S3 x }$ |8 O3 g: i2 p; r$ ]; l& q0 R. K0 t
}3 n3 U6 R+ }% A7 P/ L0 s" |
+ E1 l. o2 ^5 Y. K% q修改/etc/php.ini+ ~3 z8 Y! h9 w
short_open_tag = on
$ v1 T+ P% i& B. D# h# s#doc_root = "/www/www"
; b& d) t ~8 i, Z
- t; w2 T/ t( v& B# h7 i5 q' g) {$ R* w# j9 v3 N) a3 H
extension=ctype.so) @" w( l' c0 B" s
extension=curl.so1 O# g1 J5 K; i- X8 v
extension=gd.so' @# V' O" X0 U' \4 I1 s, {1 ^
extension=mbstring.so: p C x; n6 Q
extension=mcrypt.so
- X. y7 p/ C9 V5 @extension=mysql.so: g0 D6 m& x! F" N8 n5 p
extension=pdo.so
8 L4 v4 k0 {4 K1 @+ P+ p2 xextension=pdo_mysql.so
+ x% p2 n j$ V" Y) gextension=session.so
9 ]6 J7 p+ c$ o% Sextension=sockets.so. Y% s! S. s1 H
extension=tokenizer.so
" @/ @/ C2 j" E* O' k& eextension=xml.so
2 S: U% b. p' y! ~1 v5 S( P; r
. _; p2 i# [3 C8 {' e+ P' [5 S& f' F4 R, [3 _7 E
[Date]
4 ~+ ?6 X) f3 q6 Z4 e1 b+ udate.timezone = Asia/Shanghai
]5 s. M6 M0 v4 V- a' k/ j" u5 ^7 t$ _% Z- |5 N0 c% o; s' ^5 U6 p
: W* W+ j) k* _: p[MySQL]$ r' ]9 H% Y, t$ \+ |& g( D
mysql.default_socket = /var/run/mysqld.sock
* U( C& S! U9 R$ q! [4 E
8 t8 _: I9 U* a2 g7 c3 l9 `* u启动spawn-fcgi(开机自动运行,将命令添加到/etc/rc.local)
& N( K. h+ O9 g0 s' _; A O$ u/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 2 -f /usr/bin/php-cgi
( a; Z7 f3 D3 ^& D- Q! o* f$ B/ o3 r9 {6 S) j J
启动nginx
5 m& z, P1 [& c# |, d/etc/init.d/nginx enable
2 F0 f; q# u7 C/etc/init.d/nginx start
; \1 i* a; l, d/ b$ v5 b5 p. d/ x7 V- |" @! k/ y8 c5 H
php服务器搭建完成重启.8 D- t w- @ P/ ^' ^# Q
把钓鱼网页放入/www/sda/www目录里.在浏览器输入192.168.1.1:8000打开页面.(能打开就成功一半了~_~ )
! D# \8 a1 k6 w9 N9 _+ G$ W/ J2 L
! j7 l- a7 p# U- B6 d- Q" @
2.网页跳转(有2种方法)
U5 l0 j, u, w" c. o7 B* w6 o1DNS跳转' v/ u" a x8 b( V! G4 H
2防火墙重定向/ `5 N8 e t: {1 j+ X5 r7 k. y
1 dns跳转% R) o8 t Y, q) A! s( i! }+ b5 ?3 i
修改etc/dnsmasq.conf(需要输入对应网址才跳转)' O ^$ Q4 Q0 g. d" m
address=/www.baidu.com/192.168.1.1
t! a$ G. U, V3 s% W3 T! laddress=/www.taobao.com/192.168.1.1# x# i# [3 R) |5 G! @
2 防火墙重定向(需要联网才跳转)
" O$ h$ I% Z2 h m1 `4 x9 [修改防火墙自定义规则:
7 e) m& E$ d+ U/ A$ X- ~iptables -t nat -A PREROUTING -p tcp -m multiport --dport 80,8080 -j DNAT --to 192.168.1.1:80
p" P# Z% b$ c* W* A最后修改/etc/nginx/vhost.conf 端口为80
% y& T6 a/ V3 o+ S: m5 K( C9 I( ~, u. ^
' r) D- m6 E/ x6 R& w
9 R7 T( R+ d1 x9 f* ~
2 c7 @4 p8 Y# v' F5 ]/ M/ I重启后打开baidu网页即跳转
0 t7 B% m+ J2 b6 `. B' E y# X0 ^) K. h! l
# @! B+ W5 T+ ]8 _+ Z
- ~# `) f: q& w* w8 X
5 |/ I, h, r1 ^0 G) G使用samba映射www文件夹查看MM
4 [) ]2 ?* w* m% H5 J4 u4 p. O" O! I0 W, k
有usb口就插个网卡进行mdk3.....3 ^+ X) w9 n# D- u6 Z
7 Q! \8 q3 H N7 e. y
$ F+ g3 j' x$ j4 N
: y' ]& r I5 l1 R, j( I' z" C: q
B0 \, x& N4 I* q' `
/ B* x( B+ C- h3 s7 W5 q* T
$ N. Q% p$ H. G; S/ U% F
2 N7 b3 F9 e; s& N8 P
, ^% p2 P" c# c0 d8 _& d
, h( j0 F) d: ~& H补充内容 (2017-6-25 20:19):
- @( G9 f& d) ^( q3 j% n. t; g钓鱼页面下载 http://pan.baidu.com/s/1o8BK7Ui
# i7 w& `% C! @6 J" o' R5 k) `" g |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
评分
-
1
查看全部评分
-
|