Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 196 lines (138 sloc) 7.811 kb
a2e35ec Renamed streams program to rtmpgw
hyc authored
1 RTMP Dump v2.2
7d67491 Use trunk for main development
hyc authored
2 (C) 2009 Andrej Stepanchuk
066b686 2.1a updates: copyright year, streams description in README
hyc authored
3 (C) 2009-2010 Howard Chu
a459d3b More FP10 handshake support.
hyc authored
4 (C) 2010 2a665470ced7adb7156fcef47f8199a6371c117b8a79e399a2771e0b36384090
7d67491 Use trunk for main development
hyc authored
5 License: GPLv2
5cbd51a More 2.1c misc
hyc authored
6 http://rtmpdump.mplayerhq.hu/
7d67491 Use trunk for main development
hyc authored
7
aebb535 v2.1d updates
hyc authored
8 To compile type "make" with platform name, e.g.
7d67491 Use trunk for main development
hyc authored
9
aebb535 v2.1d updates
hyc authored
10 $ make posix
7d67491 Use trunk for main development
hyc authored
11
aebb535 v2.1d updates
hyc authored
12 for Linux, MacOSX, Unix, etc. or
7d67491 Use trunk for main development
hyc authored
13
aebb535 v2.1d updates
hyc authored
14 $ make mingw
7d67491 Use trunk for main development
hyc authored
15
aebb535 v2.1d updates
hyc authored
16 for Windows.
17
18 You can cross-compile for other platforms using
19
20 $ make cross
7d67491 Use trunk for main development
hyc authored
21
22 but you may need to override the CROSS_COMPILE and INC variables, e.g.
23
24 $ make arm CROSS_COMPILE=arm-none-linux- INC=-I/my/cross/includes
25
26 Please read the Makefile to see what other make variables are used.
27
09a0535 Drop libcurl stuff
hyc authored
28 This code also requires you to have OpenSSL and zlib installed.
a45cfbe Note that Curl and Zlib are now required
hyc authored
29
22eb25e Note where to get OpenSSL DLL for Windows
hyc authored
30 Credit goes to team boxee for the XBMC RTMP code originally used in RTMPDumper.
31 The current code is based on the XBMC code but rewritten in C by Howard Chu.
32
7d67491 Use trunk for main development
hyc authored
33
34 SWF Verification
35 ----------------
36
7fe8d4c Cleanup
hyc authored
37 Note: these instructions for manually generating the SWFVerification
38 info are provided only for historical documentation. The software can now
39 generate this info automatically, so it is no longer necessary to
40 run the commands described here. Just use the -W (--swfVfy) option
41 to perform automatic SWFVerification.
42
7d67491 Use trunk for main development
hyc authored
43 Download the swf player you want to use for SWFVerification, unzip it using
44
45 $ flasm -x file.swf
46
47 It will show the decompressed filesize, use it for --swfsize
48
49 Now generate the hash
50
51 $ openssl sha -sha256 -hmac "Genuine Adobe Flash Player 001" file.swf
52
53 and use the --swfhash "01234..." option to pass it.
54
55 e.g. $ ./rtmpdump --swfhash "123456..." --swfsize 987...
56
22eb25e Note where to get OpenSSL DLL for Windows
hyc authored
57
f267ce2 Notes for connect params
hyc authored
58 Connect Parameters
59 ------------------
60
61 Some servers expect additional custom parameters to be attached to the
62 RTMP connect request. The "--auth" option handles a specific case, where
63 a boolean TRUE followed by the given string are added to the request.
64 Other servers may require completely different parameters, so the new
65 "--conn" option has been added. This option can be set multiple times
66 on the command line, adding one parameter each time.
67
68 The argument to the option must take the form <type> : <value> where
69 type can be B for boolean, S for string, N for number, and O for object.
70 For booleans the value must be 0 or 1. Also, for objects the value must
71 be 1 to start a new object, or 0 to end the current object.
72
73 Examples:
74 --conn B:0 --conn S:hello --conn N:3.14159
75
76 Named parameters can be specified by prefixing 'N' to the type. Then the
77 name should come next, and finally the value:
78 --conn NB:myflag:1 --conn NS:category:something --conn NN:pi:3.14159
79
80 Objects may be added sequentially:
81 -C O:1 -C NB:flag:1 -C NS:status:success -C O:0 -C O:1 -C NN:time:12.30 -C O:0
82 or nested:
83 -C O:1 -C NS:code:hello -C NO:extra:1 -C NS:data:stuff -C O:0 -C O:0
84
85
7d67491 Use trunk for main development
hyc authored
86 Building OpenSSL 0.9.8k
87 -----------------------
88 arm:
89 ./Configure -DL_ENDIAN --prefix=`pwd`/armlibs linux-generic32
90
91 Then replace gcc, cc, ar, ranlib in Makefile and crypto/Makefile by arm-linux-* variants and use make && make install_sw
92
93 win32:
94 Try ./Configure mingw --prefix=`pwd`/win32libs -DL_ENDIAN -DOPENSSL_NO_HW
95 Replace gcc, cc, ... by mingw32-* variants in Makefile and crypto/Makefile
96 make && make install_sw
97
98 OpenSSL cross-compiling can be a difficult beast.
99
22eb25e Note where to get OpenSSL DLL for Windows
hyc authored
100 Precompiled OpenSSL binaries for Windows are available on
101 http://www.slproweb.com/products/Win32OpenSSL.html
102
103 If you're just running a pre-built Windows rtmpdump binary, then all you
104 need is the "Light" installer. If you want to compile rtmpdump yourself,
105 you'll need the full installer.
7d67491 Use trunk for main development
hyc authored
106
107
066b686 2.1a updates: copyright year, streams description in README
hyc authored
108 Example Servers
109 ---------------
110 Three different types of servers are also present in this distribution:
111 rtmpsrv - a stub server
112 rtmpsuck - a transparent proxy
a2e35ec Renamed streams program to rtmpgw
hyc authored
113 rtmpgw - an RTMP to HTTP gateway
091881d Add note about rtmpsrv
hyc authored
114
066b686 2.1a updates: copyright year, streams description in README
hyc authored
115 rtmpsrv - Note that this is very incomplete code, and I haven't yet decided
aebb535 v2.1d updates
hyc authored
116 whether or not to finish it. It is useful for obtaining all the parameters
117 that a real Flash client would send to an RTMP server, so that they can be
118 used with rtmpdump. The current version now invokes rtmpdump automatically
119 after parsing a client request.
066b686 2.1a updates: copyright year, streams description in README
hyc authored
120
121 rtmpsuck - proxy server. See below...
d0ef699 Notes about rtmpsuck.
hyc authored
122
091881d Add note about rtmpsrv
hyc authored
123 All you need to do is redirect your Flash clients to the machine running this
124 server and it will dump out all the connect / play parameters that the Flash
125 client sent. The simplest way to cause the redirect is by editing /etc/hosts
126 when you know the hostname of the RTMP server, and point it to localhost while
127 running rtmpsrv on your machine. (This approach should work on any OS; on
128 Windows you would edit %SystemRoot%\system32\drivers\etc\hosts.)
129
3afa522 Cleanup iptables / ipfw info
hyc authored
130 On Linux you can also use iptables to redirect all outbound RTMP traffic. You
131 need to be running as root in order to use the iptables command.
091881d Add note about rtmpsrv
hyc authored
132
133 In my original plan I would have the transparent proxy running as a special
134 user (e.g. user "proxy"), and regular Flash clients running as any other user.
135 In that case the proxy would make the connection to the real RTMP server. The
136 iptables rule would look like this:
137
138 iptables -t nat -A OUTPUT -p tcp --dport 1935 -m owner \! --uid-owner proxy \
139 -j REDIRECT
140
3afa522 Cleanup iptables / ipfw info
hyc authored
141 A rule like the above will be needed to use rtmpsuck. Note that you should
142 replace "proxy" in the above command with an account that actually exists
143 on your machine.
091881d Add note about rtmpsrv
hyc authored
144
145 Using it in this mode takes advantage of the Linux support for IP redirects;
146 in particular it uses a special getsockopt() call to retrieve the original
147 destination address of the connection. That way the proxy can create the
013740d Updates for 2.1b
hyc authored
148 real outbound connection without any other help from the user. The equivalent
149 functionality may exist on other OSs but needs more investigation.
150
3afa522 Cleanup iptables / ipfw info
hyc authored
151 (Based on reading the BSD ipfw manpage, this rule ought to work on BSD:
013740d Updates for 2.1b
hyc authored
152
3afa522 Cleanup iptables / ipfw info
hyc authored
153 ipfw add 40 fwd 127.0.0.1,1935 tcp from any to any 1935 not uid proxy
013740d Updates for 2.1b
hyc authored
154
155 Some confirmation from any BSD users would be nice.)
156
157 (We have a solution for Windows based on a TDI driver; this is known to
158 work on Win2K and WinXP but is assumed to not work on Vista or Win7 as the
159 TDI is no longer used on those OS versions. Also, none of the known
160 solutions are available as freeware.)
d0ef699 Notes about rtmpsuck.
hyc authored
161
162 The rtmpsuck command has only one option: "-z" to turn on debug logging.
163 It listens on port 1935 for RTMP sessions, but you can also redirect other
164 ports to it as needed (read the iptables docs). It first performs an RTMP
165 handshake with the client, then waits for the client to send a connect
166 request. It parses and prints the connect parameters, then makes an
167 outbound connection to the real RTMP server. It performs an RTMP handshake
168 with that server, forwards the connect request, and from that point on it
169 just relays packets back and forth between the two endpoints.
170
171 It also checks for a few packets that it treats specially: a play packet
172 from the client will get parsed so that the playpath can be displayed. It
173 also handles SWF Verification requests from the server, without forwarding
174 them to the client. (There would be no point, since the response is tied to
175 each session's handshake.)
176
177 Once the play command is processed, all subsequent audio/video data received
178 from the server will be written to a file, as well as being delivered back
179 to the client.
180
181 The point of all this, instead of just using a sniffer, is that since rtmpsuck
182 has performed real handshakes with both the client and the server, it can
183 negotiate whatever encryption keys are needed and so record the unencrypted
184 data.
066b686 2.1a updates: copyright year, streams description in README
hyc authored
185
a2e35ec Renamed streams program to rtmpgw
hyc authored
186 rtmpgw - HTTP gateway: this is an HTTP server that accepts requests that
066b686 2.1a updates: copyright year, streams description in README
hyc authored
187 consist of rtmpdump parameters. It then connects to the specified RTMP
188 server and returns the retrieved data in the HTTP response. The only valid
189 HTTP request is "GET /" but additional options can be provided in normal
190 URL-encoded fashion. E.g.
191 GET /?r=rtmp:%2f%2fserver%2fmyapp&y=somefile HTTP/1.0
192
193 is equivalent the rtmpdump parameters "-r rtmp://server/myapp -y somefile".
194
195 Note that only the shortform (single letter) rtmpdump options are supported.
Something went wrong with that request. Please try again.