-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged revisions 5591-5606,5613,5625,5645-5646 via svnmerge from
http://svn.umitproject.org/svnroot/umit/umpa/branches/link-layer-integration ........ r5591 | kosma | 2010-06-05 00:38:07 +0200 (So, 05 čen 2010) | 3 lines Initial version of SocketL2 - Linux and FreeBSD supported. With tests. L2 tests fail under BSD. L3 support not touched. ........ r5592 | kosma | 2010-06-05 01:03:33 +0200 (So, 05 čen 2010) | 1 line obliterating re module at getxsick's request :* ........ r5593 | kosma | 2010-06-05 01:15:34 +0200 (So, 05 čen 2010) | 1 line platform check: convert find to startswith ........ r5594 | kosma | 2010-06-05 01:16:59 +0200 (So, 05 čen 2010) | 1 line platform check: detect MS Windows via os.name ........ r5595 | kosma | 2010-06-05 12:39:43 +0200 (So, 05 čen 2010) | 1 line added a _Socket superclass ........ r5596 | kosma | 2010-06-05 13:16:45 +0200 (So, 05 čen 2010) | 2 lines moved 'get packet destination' to class Packet, with tests ........ r5597 | kosma | 2010-06-05 18:23:57 +0200 (So, 05 čen 2010) | 2 lines Port L3 code to new style. Add BSD endianness quirk support w/test. ........ r5598 | kosma | 2010-06-05 19:32:07 +0200 (So, 05 čen 2010) | 2 lines Load fcntl module conditionally - it's not present under Win32. ........ r5599 | kosma | 2010-06-05 21:28:44 +0200 (So, 05 čen 2010) | 1 line fix a typo preventing L3 sockets from working under OpenBSD ........ r5600 | kosma | 2010-06-05 22:15:52 +0200 (So, 05 čen 2010) | 1 line Fixed L2 send (bpf) under OpenBSD. ........ r5601 | kosma | 2010-06-05 22:39:46 +0200 (So, 05 čen 2010) | 1 line minor documentation issue ........ r5602 | kosma | 2010-06-05 23:42:41 +0200 (So, 05 čen 2010) | 1 line example for SocketL2 usage ........ r5603 | kosma | 2010-06-05 23:46:17 +0200 (So, 05 čen 2010) | 2 lines Set svn:executable property on examples, install scripts and setup.py. ........ r5604 | kosma | 2010-06-05 23:58:42 +0200 (So, 05 čen 2010) | 1 line set svn:ignore on generated documentation dirs ........ r5605 | kosma | 2010-06-06 00:09:36 +0200 (Ne, 06 čen 2010) | 6 lines README file update. - New library description from the trac site. - Added myself to Authors section (hope I won't get killed for that ;). - Formatting cleanups, rephrasing, etc. ........ r5606 | kosma | 2010-06-06 00:21:49 +0200 (Ne, 06 čen 2010) | 1 line apply changes to cloned README in docs/ ........ r5613 | getxsick | 2010-06-16 19:41:53 +0200 (St, 16 čen 2010) | 2 lines rename UMPA repository to umpa ........ r5625 | getxsick | 2010-06-18 14:48:59 +0200 (Pá, 18 čen 2010) | 2 lines rename umpa/branch to umpa/branches (even if i prefer branch/) ........ r5645 | kosma | 2010-06-19 18:00:18 +0200 (So, 19 čen 2010) | 1 line revert a too-hasty documentation change ........ r5646 | kosma | 2010-06-19 19:14:44 +0200 (So, 19 čen 2010) | 1 line information on L3 sockets under xp sp2 ........ git-svn-id: http://svn.umitproject.org/svnroot/umit/umpa/trunk@5651 1105ee14-b0fa-0310-85a5-ff3eed429ff7
- Loading branch information
Showing
20 changed files
with
448 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
# Copyright (C) 2010 Adriano Monteiro Marques. | ||
# | ||
# Author: Kosma Moczek <kosma at kosma dot pl> | ||
# | ||
# This library is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU Lesser General Public License as published | ||
# by the Free Software Foundation; either version 2.1 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This library is distributed in the hope that it will be useful, but | ||
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public | ||
# License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public License | ||
# along with this library; if not, write to the Free Software Foundation, | ||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
|
||
""" | ||
This example shows how to send raw Ethernet frames using SocketL2 class. | ||
""" | ||
|
||
import umit.umpa | ||
import umit.umpa.utils.security | ||
|
||
from umit.umpa.protocols import Ethernet, IP, UDP, Payload | ||
from umit.umpa import SocketL2, Packet | ||
|
||
# Create a raw Ethernet socket. The 'iface' argument is mandatory. | ||
sock = umit.umpa.SocketL2(iface='eth0') | ||
|
||
# Drop root privileges after socket creation. This improves security. | ||
umit.umpa.utils.security.drop_priviliges() | ||
|
||
# Create protocol objects. We need to specify MAC addresses since we operate | ||
# on the link layer. | ||
ethernet = Ethernet(src='00:11:22:33:44:55', dst='01:23:45:67:89:AB') | ||
ip = IP(src='192.168.1.234', dst='192.168.1.1') | ||
udp = UDP(srcport=1234, dstport=4321) | ||
payload = Payload("UMPA") | ||
|
||
# Create a new Packet object. | ||
packet = Packet(ethernet, ip, udp, payload) | ||
|
||
# Send the packet. Use a network sniffer (e.g. Wireshark) to see it. | ||
sock.send(packet) |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.