Changeset 867:3119fab4456a
- Timestamp:
- 08/12/08 01:03:59
(3 months ago)
- Author:
- Phil <phil@secdev.org>
- Message:
Return execution errors in sendpfast() (ticket #120)
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r862 |
r867 |
|
| 4 | 4 | ## This program is published under a GPLv2 license |
|---|
| 5 | 5 | |
|---|
| 6 | | import cPickle,os,sys,time |
|---|
| | 6 | import cPickle,os,sys,time,subprocess |
|---|
| 7 | 7 | from select import select |
|---|
| 8 | 8 | from data import * |
|---|
| … | … | |
| 253 | 253 | if iface is None: |
|---|
| 254 | 254 | iface = conf.iface |
|---|
| 255 | | options = ["--intf1=%s" % iface ] |
|---|
| | 255 | argv = [conf.prog.tcpreplay, "--intf1=%s" % iface ] |
|---|
| 256 | 256 | if pps is not None: |
|---|
| 257 | | options.append("--pps=%i" % pps) |
|---|
| | 257 | argv.append("--pps=%i" % pps) |
|---|
| 258 | 258 | elif mbps is not None: |
|---|
| 259 | | options.append("--mbps=%i" % mbps) |
|---|
| | 259 | argv.append("--mbps=%i" % mbps) |
|---|
| 260 | 260 | elif realtime is not None: |
|---|
| 261 | | options.append("--multiplier=%i" % realtime) |
|---|
| | 261 | argv.append("--multiplier=%i" % realtime) |
|---|
| 262 | 262 | else: |
|---|
| 263 | | options.append("--topspeed") |
|---|
| | 263 | argv.append("--topspeed") |
|---|
| 264 | 264 | |
|---|
| 265 | 265 | if loop: |
|---|
| 266 | | options.append("--loop=%i" % loop) |
|---|
| | 266 | argv.append("--loop=%i" % loop) |
|---|
| 267 | 267 | |
|---|
| 268 | 268 | f = os.tempnam("scapy") |
|---|
| 269 | | options.append(f) |
|---|
| | 269 | argv.append(f) |
|---|
| 270 | 270 | wrpcap(f, x) |
|---|
| 271 | 271 | try: |
|---|
| 272 | | try: |
|---|
| 273 | | os.spawnlp(os.P_WAIT, conf.prog.tcpreplay, conf.prog.tcpreplay, *options) |
|---|
| 274 | | except KeyboardInterrupt: |
|---|
| 275 | | log_interactive.info("Interrupted by user") |
|---|
| | 272 | subprocess.check_call(argv) |
|---|
| | 273 | except KeyboardInterrupt: |
|---|
| | 274 | log_interactive.info("Interrupted by user") |
|---|
| | 275 | except Exception,e: |
|---|
| | 276 | log_interactive.error(e) |
|---|
| 276 | 277 | finally: |
|---|
| 277 | 278 | os.unlink(f) |
|---|