Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scripts-perso
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Daniel Stan
scripts-perso
Commits
139ec4f0
Commit
139ec4f0
authored
Dec 23, 2016
by
Daniel STAN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bin fe80
parent
7d8c3c6d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
bin/fe80
bin/fe80
+31
-0
No files found.
bin/fe80
0 → 100755
View file @
139ec4f0
#!/usr/bin/python3
# Petit script à deux balles qui renvoie l'ipv6 de lien local à partir de la
# mac (eui64). L'intérêt est de pouvoir rapidement "pinguer une mac"
# Par exemple:
# | $ ping6 $(fe80 00:19:bb:3c:4f:76)%eth0
# | PING fe80::219:bbff:fe3c:4f76%eth0(fe80::219:bbff:fe3c:4f76) 56 data bytes
# | 64 bytes from fe80::219:bbff:fe3c:4f76: icmp_seq=1 ttl=64 time=0.441 ms
import
sys
,
re
HEX
=
r
'([0-9a-zA-Z]{1,2})'
SEP
=
r
'[^0-9a-zA-Z]?'
MAC
=
(
HEX
+
SEP
)
*
5
+
HEX
if
len
(
sys
.
argv
)
<
2
:
print
(
"Donne une mac"
)
sys
.
exit
(
1
)
match
=
re
.
match
(
MAC
,
sys
.
argv
[
1
])
if
match
is
None
:
print
(
"Mac non reconnue"
)
sys
.
exit
(
2
)
mac
=
[
int
(
match
.
group
(
i
),
16
)
for
i
in
range
(
1
,
7
)
]
mac
[
0
]
=
mac
[
0
]
^
2
mac
.
insert
(
3
,
0xfe
)
mac
.
insert
(
3
,
0xff
)
end_ip
=
[
(
mac
[
2
*
i
]
*
0x100
+
mac
[
2
*
i
+
1
])
for
i
in
range
(
0
,
4
)
]
print
(
"fe80::%s"
%
":"
.
join
(
"%x"
%
s
for
s
in
end_ip
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment