-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathConvert_Packet_Debug.xml
86 lines (65 loc) · 1.8 KB
/
Convert_Packet_Debug.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Monday, July 20, 2009, 10:47 AM -->
<!-- MuClient version 4.43 -->
<!-- Plugin "Convert_Packet_Debug" generated by Plugin Wizard -->
<muclient>
<plugin
name="Convert_Packet_Debug"
author="Nick Gammon"
id="cae868ff0b7d205596cf6db7"
language="Lua"
purpose="Converts packet debug lines for Test Trigger"
date_written="2009-07-20 10:45:55"
requires="4.40"
version="1.1"
>
<description trim="y">
<![CDATA[
1. Copy some packet debug to the Clipboard (possibly omitting sent packets)
2. Type: convert_packet
3. Converted packet will be echoed to output.
Extra lines which don't look like packet debug will be ignored.
]]>
</description>
</plugin>
<!-- Aliases -->
<aliases>
<alias
script="convert_packet"
match="convert_packet"
enabled="y"
sequence="100"
>
</alias>
</aliases>
<!-- Script -->
<script>
<![CDATA[
require "getlines"
function convert_packet (name, line, wildcards)
-- get clipboard
local clip = GetClipboard ()
-- starting line of hyphens
print (string.rep ("-", 60))
-- for each line see if it looks like a debug line
-- debug lines have 16 ASCII characters, 3 spaces, and then some hex stuff
for line in getlines (clip) do
local hex = string.match (line, "^................ ([%x ]+)%s*$")
if hex then -- looks OK
for s in string.gmatch (hex, "%x%x") do
c = string.char (tonumber (s, 16))
if c >= ' ' and c <= string.char (0x7F) then
Tell (c)
else
Tell ("\\" .. s) -- output without a linebreak
end -- if
end -- for
end -- seems to be a packet debug line
end -- for loop
print ("") -- new line
print (string.rep ("-", 60))
end -- function convert_packet
]]>
</script>
</muclient>