上校
- 注册时间
- 2009-10-11
- 金币
- 14196 个
- 威望
- 2 个
- 荣誉
- 1 个
累计签到:1700 天 连续签到:1 天 [LV.1825]无线元老
|
本帖最后由 476867546 于 2016-3-10 17:33 编辑
9 E. l+ {3 O+ O$ q \8 Z9 O+ l+ \" e, ?: h
Openwrt 无线路由器搭建php服务器实现钓鱼.
' W0 ^$ a& r, l' P; A1 h 本人也是小白,都是在网上找的资料.已成功搭建钓鱼环境,现分享给大家.教程只演示不带USB口的.#无线路由器刷Openwrt要求16M闪存.带USB接口或不带都行(带的网址放U盘里.不带的放路由器目录里)& `4 j8 |3 m0 [. S# T
: m8 j+ |# v# e0 U. f0 r$ {9 A准备工作:/ B. p. Q; T* D
winSCP连接路由在/www下建立一个sda/www文件夹; ^) d/ o) P) ^( O: v! i
/ C$ t# x8 h" B' F9 s) y
1.安装nginx+php+mysql6 n/ U/ x- V% J$ ^- L2 P/ Y
# s( q$ W3 F) T+ l3 s$ g- u进路由里修改openwrt安装源如下:
. R& Q# n6 }* \" L! ^1 Hdest root /
1 H" K" E# ?3 ~5 s' Edest ram /tmp
- }; h3 F# E( h* i6 r2 Y& Rlists_dir ext /var/opkg-lists
, C2 z6 S! A, e9 t+ e5 Yoption overlay_root /overlay: ]6 f' @, Y7 G! C6 V# P
src/gz chaos_calmer_base http://downloads.openwrt.org/cha ... neric/packages/base& R+ W4 l$ r# k$ i* M
src/gz chaos_calmer_packages http://downloads.openwrt.org/cha ... c/packages/packages$ m8 l3 g$ _5 [0 W2 m0 f
src/gz chaos_calmer_routing http://downloads.openwrt.org/cha ... ic/packages/routing
; p: O7 q6 B/ U$ x6 \src/gz chaos_calmer_telephony http://downloads.openwrt.org/cha ... /packages/telephony
6 f. l3 j$ f! p4 z* ^1 \6 M5 Y* Usrc/gz chaos_calmer_management http://downloads.openwrt.org/cha ... packages/management
! h0 h2 `. _! n6 ~/ R打开putty终端更新并安装软件.5 R' z. Z# R3 U" T% Q
opkg update" X. M- n" g+ h2 W- t1 k( w
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-zip8 x2 L% p) v/ c3 g) O
, n% m; R* q: Mopkg install mysql-server
$ R7 O" D% [4 G6 \* @2 K% O3 \5 {3 C# c! C$ i: `* R" X$ K2 f. p4 l* z/ [
opkg install nginx spawn-fcgi zoneinfo-core zoneinfo-asia1 d% T/ a9 _7 e* n2 c
5 N7 `' J7 u1 F6 s
opkg install shadow-groupadd shadow-useradd
' K. d. @% ~3 f2 u0 [' P3 l* r# ?- Q0 u! W
groupadd www
( ^ {9 N* ^" d. T$ T( }& I: Y1 d
7 P* Y0 m: d/ r- ]% [" Fuseradd -g www www
# I0 L2 H$ z6 m' {- B) O% y$ j6 o/ |
chown -R www:www /www/sda/www重启!# m& ?+ ^2 \- t, @2 p# i. R
winSCP连接路由修改/etc/my.cnf(改掉这两段)
, a3 j3 I" g+ t4 `datadir = /www/sda/data/mysql/$ r- H. M: v! a
tmpdir = /www/sda/data/tmp/
& l# e4 e. X Q7 k1 U3 Y2 @ W2 c% ~
- Z `5 @5 y0 @4 J5 Y2 ?9 w+ }0 b
创建数据库文件夹
% S+ b5 `( t4 u" |" V1 l0 tmkdir -p /www/sda/data /www/sda/data/mysql /www/sda/data/tmp, W4 U6 H9 P1 M
+ C! t' M1 E$ y) ]创建默认的数据库
. v6 a9 j/ ^5 e: O5 F3 _/usr/bin/mysql_install_db --force4 }* N% w0 _& m A
, K, _& x6 |2 c F% t% }6 `启动mysql
6 O9 f; | ^. ^5 _* R9 E/etc/init.d/mysqld start9 o( t) v7 s \! R- a( Q( L! C
输入如下命令创建mysql的密码
$ m2 P. R1 G! ]4 O' x/usr/bin/mysqladmin -u root password 123456! n+ a. z- U& f+ ^7 K
登陆数据库
6 u7 {) P! ~( I5 b, a' [mysql -u root -p g$ n7 G9 x9 T( T [9 P' G8 V2 _
% M& c* L/ r) ~ ?5 c修改/etc/nginx/nginx.conf. w& ~' |, C \7 T+ Q, t& @
user www www;
; L" k, F$ O" J# x% kworker_processes 1;
9 @; V, i) j o5 p C, Dpid /var/run/nginx.pid;
6 i) O# ]- k; Aerror_log /var/log/nginx_error.log;
" l4 P, {- X0 Z U/ Sevents {
, |( q i% C6 h. h use epoll;( {& |4 m: g" E/ K1 |
worker_connections 1024;
7 n$ Z) W$ _4 J$ Y2 p0 w0 @* c}# j# ]$ y, k0 J0 s3 o( T1 d
* J+ `" ]$ F1 v. l; m
7 p& j9 `) w5 p7 D! x
http {- E7 {$ T& d4 `$ Y# R
include mime.types;5 d5 ~# E4 q& K+ @" J! |8 x8 |, F# C
default_type application/octet-stream;9 c) e; }% v# W# T7 |
sendfile on;6 R2 O6 Y3 F! U; J7 H3 O6 @( H
tcp_nopush on;# D% ^: q* y& C8 f9 v% P( y- H
#keepalive_timeout 0;
+ v3 N& n9 [' `( W& w( Y keepalive_timeout 65;
! y: u6 O$ | `8 C5 I$ g/ \ gzip on;
1 _% V/ X, N! D8 I6 \ W0 z) K2 Q1 A access_log off;
0 W1 g' H+ \/ H
4 j+ Y/ E* F0 u$ R7 S. Y include vhost.conf;; z( ?; ^! G( f8 k
}
, v. W$ J; N& u [0 _' U; f- z/ `& k! A9 h/ N0 l
修改/etc/nginx/fastcgi_params: f. P6 h" [" c0 g
if ($request_filename ~* (.*)\.php) {
. F- L3 K! O0 [, _9 b% p set $php_url $1;2 }- P+ P4 h7 N2 R5 N. k
}
3 [" I4 L" a% v+ e9 t, C9 Aif (!-e $php_url.php) {
$ ?1 K! u! ]9 T& H$ d$ r return 403;' `/ j1 ~7 F, y1 B9 v. G8 k
}; R+ b5 e$ H, m- k( B7 h& n
9 i5 X l6 ?9 a; V1 C0 V, u
! c2 B9 A3 S4 b4 y# v, ffastcgi_param QUERY_STRING $query_string;# n v [7 [4 J8 g( q
fastcgi_param REQUEST_METHOD $request_method;
( G5 H5 t N; {* p) _9 Kfastcgi_param CONTENT_TYPE $content_type;
" q% y( `* s( g$ R9 T T/ Yfastcgi_param CONTENT_LENGTH $content_length;
& o0 W& v) L' R6 ?9 P- @
3 N* G- ~8 q4 K B( A% W5 a! z( ]& b; z) d7 u8 V8 ?' r+ \9 Y
fastcgi_param SCRIPT_NAME $fastcgi_script_name;1 }* Z3 \5 L3 h: a2 X, i6 f- Q
fastcgi_param REQUEST_URI $request_uri;
% n6 P9 r0 N( B* G4 x9 c1 gfastcgi_param DOCUMENT_URI $document_uri;
! z+ J5 s3 B* ^/ ?* P+ q& Kfastcgi_param DOCUMENT_ROOT $document_root;$ g& Q. C( Q/ S+ \
fastcgi_param SERVER_PROTOCOL $server_protocol;6 z/ I, X5 `! u4 l$ p+ h1 w$ x# N" \
p3 e; I c: t! u9 S
7 S" @2 C# g r% c7 p2 o7 j& L3 ^) ]fastcgi_param GATEWAY_INTERFACE CGI/1.1;% \# k& X. E0 n3 c& O
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
8 F, z" M$ l. T' S& I4 d/ o8 m( l& g ^6 X( ~" \# x
& G# c2 K6 X$ r8 H+ K
fastcgi_param REMOTE_ADDR $remote_addr;% N( B3 h1 K1 [/ [# q
fastcgi_param REMOTE_PORT $remote_port;- t) Z" M; }0 j& u+ _. d) p
fastcgi_param SERVER_ADDR $server_addr;% E, b8 A2 F) |4 I/ Y: N
fastcgi_param SERVER_PORT $server_port;
# F2 _2 f: C3 i1 K& Qfastcgi_param SERVER_NAME $server_name;6 ?/ R) y1 M& o3 d/ l
- {% w4 N1 O. ^1 K6 u' _- {; |
0 ^1 t9 M* B- B1 o% P3 G6 v, Z# PHP only, required if PHP was built with --enable-force-cgi-redirect/ q/ n- \2 u) f3 S
fastcgi_param REDIRECT_STATUS 200;
4 X7 W) Y) p! y) L/ ^ W+ [# z% ~6 E) N$ n! z G% e
添加文件/etc/nginx/vhost.conf
8 G$ W- M, B4 l2 @/ @server {/ z: u4 j' M! P# i4 R
listen 8000;
; u" |0 C$ e: c4 T! T4 X! o7 `3 m server_name localhost;- e2 A# w* ~* y+ h4 x; S6 H
root /www/sda/www;
0 s v% p+ L4 `- [# A index index.html index.htm index.php default.php;2 t7 M( w$ k; R
error_page 500 502 503 504 /50x.html;
$ P* {* Q6 C- O f, s, j0 W
( f, F8 k$ _8 p5 r0 V6 p1 D5 Q1 u) Z. |
location = /50x.html {
& c" [2 l6 }7 v8 U/ W+ C root html;
$ z8 G$ N* R8 p! T }# q+ Q6 y$ ~, U; M& j' e# d
6 c" F3 A. s3 \
2 _; h" g6 m3 ~+ t& k0 h5 m location ~* ^.+\.php(\/.*)*$ {
0 ]/ w7 q+ m- U3 V( X fastcgi_pass 127.0.0.1:9000;
& n W% r6 `1 X8 n2 N$ Q0 j fastcgi_index index.php;( s; [5 ~# Q J- r
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;1 i5 C# N s6 W: b9 {/ a
include fastcgi_params;
7 F0 v- ]; [1 f, K5 v( Q }& ^0 @6 {( G' t! r( p# }' f L; H
}
3 W0 K/ R5 ^" p! V. l
2 I& ^1 O2 D) J8 n+ ~$ W" H( N修改/etc/php.ini
6 g1 G% w- a7 y3 }7 Y5 i6 F9 }short_open_tag = on
: S% s: H6 i: T2 @3 K( @#doc_root = "/www/www" 8 U- Z6 \: c: T& n+ [* K `
- E+ N% m' v+ |% ^
! v& X ]" L7 n# R
extension=ctype.so! I- k# z/ Q8 a4 b% N
extension=curl.so+ z- Y: _! _% N4 L- ?6 r
extension=gd.so/ `& R/ ~; S% D$ y/ {; w* `
extension=mbstring.so
! @8 J; w) A* T. Bextension=mcrypt.so1 o, f* X, p5 x6 ?
extension=mysql.so
3 q* L/ p- z% |; A2 Fextension=pdo.so2 b" M5 i% I& n$ z7 c3 z9 q
extension=pdo_mysql.so
# q& a( _( j# |" G: M5 aextension=session.so
. G1 I1 U- M. f, Fextension=sockets.so
+ K, q; x# r$ p' b( hextension=tokenizer.so
; G& o' S [* B3 n$ J# o: t/ aextension=xml.so2 ]) m+ Q) R. v* v
& W* Z. ^) ~- b2 l6 O% D) @" N
3 j7 m- F& A$ Q0 k" g1 e[Date], L+ l3 A, N" R5 j# I4 `0 _
date.timezone = Asia/Shanghai% b& l) V5 r/ E: D7 ^; v6 \
D* \* r3 H4 G8 o
: S, p: z5 _, i
[MySQL]
3 U* @* M* _* w! {4 Lmysql.default_socket = /var/run/mysqld.sock
. c4 l) |/ a- p" H' W, t2 `) d" U. _. `. N: A& a+ n
启动spawn-fcgi(开机自动运行,将命令添加到/etc/rc.local)
% i ^4 d! [6 D9 N4 k/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 2 -f /usr/bin/php-cgi
$ Q- ?" J5 O2 j: Y6 i4 c! K( \- c" [9 a) u8 R# F4 w
启动nginx
! t% A& |8 C% j3 @: W7 T/etc/init.d/nginx enable. \: i5 o) s+ H& t3 Q
/etc/init.d/nginx start
- [5 m/ o3 Q$ O/ \6 n! _+ f! ]2 |
5 ~6 f/ i5 h5 g) b* z sphp服务器搭建完成重启.8 X1 l0 A4 Z7 T4 n) ~( t0 ~3 H: m
把钓鱼网页放入/www/sda/www目录里.在浏览器输入192.168.1.1:8000打开页面.(能打开就成功一半了~_~ )6 E4 \2 T0 m+ a: Y, ~
! @1 a" d% A0 K$ Z
5 u& y7 a, }" r
2.网页跳转(有2种方法)" F* ]8 x8 Y v2 O6 D
1DNS跳转
8 S2 s% {# k/ ?2 ^' y! d, f2防火墙重定向& ]5 ~8 ^! Z& v5 U5 m# s1 y( ~" E4 r
1 dns跳转% T9 g% \5 t. p
修改etc/dnsmasq.conf(需要输入对应网址才跳转)
! ]# V& R2 q; U% R2 r' {% Y x- oaddress=/www.baidu.com/192.168.1.1
* O+ T1 D% ^. s: @address=/www.taobao.com/192.168.1.1# |7 ~" w+ u5 k; f' Y6 P) i
2 防火墙重定向(需要联网才跳转)% l5 r8 n! d/ t: m- ~8 x
修改防火墙自定义规则:
4 i- O# v7 X* @; F5 M6 [iptables -t nat -A PREROUTING -p tcp -m multiport --dport 80,8080 -j DNAT --to 192.168.1.1:80, L* A- K. z+ w# f( v# h* V
最后修改/etc/nginx/vhost.conf 端口为80
* k2 k) Q& Q" M j2 a2 Y9 A
7 b. L$ F3 [+ @; t: f- r4 J5 W% U3 J: Y7 g4 y# f( c3 }
3 n7 [! p8 v0 G- W, G: b9 _
! F }4 q4 s, v4 ]- @ S2 g1 f重启后打开baidu网页即跳转, o* w' E8 H- X% R
, z( E/ Y' n! n2 j( o+ a& e3 _: z
8 B# i9 S6 y# `/ }, W% X
# X) L2 F3 z/ u: v. c5 q& |* E6 U
使用samba映射www文件夹查看MM+ b% m+ T# M4 [0 s8 i
$ h0 K7 r! C0 T有usb口就插个网卡进行mdk3.....
6 g! Q" n$ D, J# J9 ]6 s3 ^& _* P" T2 u3 H, M/ K
2 B$ F- D4 l" X4 z( T4 l
! a9 p8 z L; ]: k
* E% P; r4 o& i) d8 |1 ^
; G+ `2 {: O, X5 a! \6 m/ `; n
9 c$ H( F8 O: ^/ c b
# x! k+ I; v6 x$ c4 z4 f$ Y9 y2 R5 b
. h# {5 e! \$ }% T补充内容 (2017-6-25 20:19):
, u. t3 ~3 N4 {, M; k, n0 x& `! N钓鱼页面下载 http://pan.baidu.com/s/1o8BK7Ui P, b) I! k* d0 j6 N& e* N
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
评分
-
1
查看全部评分
-
|