-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathfish_10.mrc
424 lines (371 loc) · 13.8 KB
/
fish_10.mrc
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
;**************
;* FiSH 10 mIRC Script - Hugely based on FiSH v1.30 *
;**************
; "FiSH 10" by the way means "FiSH 2" in binary, and the year is 2010, therefore "FiSH 10".
on *:START: {
if ($readini($mircini,about,portable) == yes) {
set %blow_ini $shortfn($nofile($mircexe) $+ blow.ini)
}
else {
set %blow_ini $shortfn($mircdir $+ blow.ini)
}
set %FiSH_dll $qt($nofile($mircexe) $+ fish_10.dll)
; these calls must be made in exactly this order:
.dll $qt($nofile($mircexe) $+ fish_inject.dll) _callMe
.dll %FiSH_dll _callMe
.dll %FiSH_dll FiSH_SetIniPath %blow_ini
}
; *** auto-keyXchange ***
on *:OPEN:?:{
if (%autokeyx == [On]) {
var %tmp1 = $dll(%FiSH_dll,FiSH_GetKey10,$network $nick)
if ($len(%tmp1) > 0) {
FiSH.DH1080_INIT $nick
}
unset %tmp1
}
}
; ######################################
; ### mark outgoing (own text) START ###
; *** For maximum compatibility I recommend you to disable this feature
; *** (or even delete the whole section from here)
on *:INPUT:*:{
if (($left($1,1) == /) || (!$1) || (%mark_outgoing != [On])) return
if ($dll(%FiSH_dll,INI_GetBool,process_outgoing 1) == 0) return
if ($len($dll(%FiSH_dll,FiSH_GetKey10,$network $target)) > 1) {
var %tmp1 = $readini %blow_ini FiSH plain_prefix
if (%tmp1 == $null) { %tmp1 = +p }
var %pfxlen = $len(%tmp1)
if (%tmp1 != $left($1,%pfxlen)) {
var %tmp1 = $readini %blow_ini FiSH mark_encrypted
if (%mark_style == $null) { %mark_style = 2 }
if (%tmp1 == $null) { %tmp1 = $chr(2) $+ $chr(3) $+ 12· $+ $chr(3) $+ $chr(2) }
;### <mynick> own encrypted text [default crypt mark] ###
if (%mark_style == 1) {
var %own_encrypted_text = < $+ $iif(($gettok($readini(mirc.ini, options, n2), 30, 44)) && (($me isvoice $chan) || ($me isop $chan)), $left($nick(#, $nick).pnick, 1)) $+ $nick $+ > $1- $+ $chr(32) $+ %tmp1
}
;### <mynick> [default crypt mark] own encrypted text ###
if (%mark_style == 2) {
var %own_encrypted_text = < $+ $iif(($gettok($readini(mirc.ini, options, n2), 30, 44)) && (($me isvoice $chan) || ($me isop $chan)), $left($nick(#, $nick).pnick, 1)) $+ $nick $+ > $+ %tmp1 $1-
}
;### <mynick> own encrypted text (the nick brackets are bold+blue) ###
if (%mark_style == 3) {
var %own_encrypted_text = $+($chr(2), $chr(3), 12<, $chr(3), $chr(2)) $+ $iif(($gettok($readini(mirc.ini, options, n2), 30, 44)) && (($me isvoice $chan) || ($me isop $chan)), $left($nick(#, $nick).pnick, 1)) $+ $nick $+ $+($chr(2), $chr(3), 12>, $chr(3), $chr(2)) $1-
}
echo $color(Own text) -tlbfm %own_encrypted_text
}
else {
echo $color(Own text) -tlbfm < $+ $iif(($gettok($readini(mirc.ini, options, n2), 30, 44)) && (($me isvoice $chan) || ($me isop $chan)), $left($nick(#, $nick).pnick, 1)) $+ $nick $+ > $right($1-, $calc(0 - %pfxlen))
}
if ($target ischan) { .msg $target $1- }
else { .privmsg $target $1- }
halt
}
unset %tmp1
}
; ### mark outgoing (own text) END ###
; ####################################
on *:CONNECT:{
if (%autoset_localip == [On]) {
localinfo FiSH.OWNZ $dll(%FiSH_dll,FiSH_GetMyIP,NOT_USED)
}
}
on *:NICK:{
if (($nick == $me) || ($upper($newnick) == $upper($nick))) { return }
if (($query($newnick) == $null) || (%NickTrack != [On])) { return }
var %ky_tmp = $dll(%FiSH_dll,FiSH_GetKey10,$network $nick)
if ($len(%ky_tmp) > 4) {
writeini -n %blow_ini $newnick key %ky_tmp
writeini -n %blow_ini $newnick dh1080_cbc $readini(%blow_ini,$nick,dh1080_cbc)
}
unset %ky_tmp
}
on ^*:NOTICE:DH1080_INIT*:?:{
if ($len($2) > 178 && $len($2) < 182) {
query $nick
echo $color(Mode text) -tm $nick *** FiSH: Received DH1080 public key from $nick $+ , sending mine...
var %tempkey $dll(%FiSH_dll,DH1080_gen,NOT_USED)
%FiSH.prv_key = $gettok(%tempkey, 1, 32)
%FiSH.pub_key = $gettok(%tempkey, 2, 32)
unset %tempkey
var %secret = $dll(%FiSH_dll,DH1080_comp, %FiSH.prv_key $2)
if ($3 == CBC) {
.notice $nick DH1080_FINISH %FiSH.pub_key CBC
FiSH.setkey $nick cbc: $+ %secret
}
else {
.notice $nick DH1080_FINISH %FiSH.pub_key
FiSH.setkey $nick %secret
}
unset %FiSH.prv_key
unset %FiSH.pub_key
unset %secret
}
halt
}
on ^*:NOTICE:DH1080_FINISH*:?:{
if ( %FiSH.dh [ $+ [ $nick ] ] != 1 ) {
echo "No keyXchange in progress!"
halt
}
if ($len($2) > 178 && $len($2) < 182) {
if ($len(%FiSH.prv_key) == 180 || $len(%FiSH.prv_key) == 181) {
var %secret = $dll(%FiSH_dll,DH1080_comp, %FiSH.prv_key $2)
if ($3 == CBC) FiSH.setkey $nick cbc: $+ %secret
else FiSH.setkey $nick %secret
unset %FiSH.dh $+ [ $nick ]
unset %FiSH.prv_key
unset %FiSH.pub_key
unset %secret
}
}
halt
}
alias -l FiSH.WriteKey {
if ($2 == /query) var %cur_contact = $active
else var %cur_contact = $2
if ($3- == $null) return
if ($dll(%FiSH_dll,FiSH_WriteKey10,$1 $network %cur_contact $3-) == ok) {
var %info = *** FiSH: Key for %cur_contact set to *censored* $iif($gettok($3-,1,58) == cbc, (CBC Mode), )
if ($window(%cur_contact) == $null) echo $color(Mode text) -at %info
else echo $color(Mode text) -tm %cur_contact %info
}
}
alias FiSH.setkey { FiSH.WriteKey decode_utf8 $1 $2- }
alias FiSH.setkey_utf8 { FiSH.WriteKey raw_bytes $1 $2- }
alias FiSH.usechankey {
var %theKey = $readini %blow_ini $2 key
if (%theKey == $null) {
echo $color(Mode text) -at *** FiSH: No valid key for $2 found
}
else {
writeini -n %blow_ini $1 key %theKey
writeini -n %blow_ini $1 date $date
unset %theKey
echo $color(Mode text) -at *** FiSH: Using same key as $2 for $1
}
}
alias FiSH.showkey {
if ($1 == /query) var %cur_contact = $active
else var %cur_contact = $1
%theKey = $dll(%FiSH_dll,FiSH_GetKey10, $network %cur_contact)
if (%theKey != $null) {
window -dCo +l @Blowcrypt-Key -1 -1 500 80
aline @Blowcrypt-Key Key for %cur_contact :
aline -p @Blowcrypt-Key %theKey
unset %theKey
}
else {
echo $color(Mode text) -at *** FiSH: No valid key for %cur_contact found
}
}
alias FiSH.removekey {
if ($1 == /query) var %cur_contact = $active
else var %cur_contact = $1
$dll(%FiSH_dll,FiSH_DelKey10,$network %cur_contact)
echo $color(Mode text) -at *** FiSH: Key for %cur_contact has been removed
}
alias keyx { FiSH.DH1080_INIT $1 }
alias FiSH.DH1080_INIT {
if ( ($1 == /query) || ($1 == $null) ) var %cur_contact = $active
else var %cur_contact = $1
set %FiSH.dh $+ [ %cur_contact ] 1
var %tempkey $dll(%FiSH_dll,DH1080_gen,NOT_USED)
%FiSH.prv_key = $gettok(%tempkey, 1, 32)
%FiSH.pub_key = $gettok(%tempkey, 2, 32)
unset %tempkey
.NOTICE %cur_contact DH1080_INIT %FiSH.pub_key $iif($dll(%FiSH_dll,INI_GetSectionBool,$network %cur_contact dh1080_cbc 1) == 0,, CBC)
echo $color(Mode text) -tm $nick *** FiSH: Sent my DH1080 public key to %cur_contact $+ , waiting for reply ...
}
alias FiSH.prefix {
if ($1 != $null) {
writeini -n %blow_ini FiSH plain_prefix $1-
flushini mirc.ini
echo $color(Mode text) -at *** FiSH: Plain-prefix set to $1-
}
}
alias FiSH.showmyip {
window -dCo +l @Local-IP -1 -1 500 80
aline @Local-IP Your external IP address :
aline -p @Local-IP $dll(%FiSH_dll,FiSH_GetMyIP,FiSH)
}
menu channel {
-
FiSH
.Show key :FiSH.showkey $chan
.Set new key :FiSH.setkey $chan $?
.Set new key (UTF-8) :FiSH.setkey_utf8 $chan $?
.Remove key :FiSH.removekey $chan
}
menu query {
-
FiSH
.DH1080 keyXchange: FiSH.DH1080_INIT $1
.-
.Show key :FiSH.showkey $1
.Set new key :FiSH.setkey $1 $?
.Set new key (UTF-8) :FiSH.setkey_utf8 $1 $?
.Remove key :FiSH.removekey $1
}
menu nicklist {
-
FiSH
.DH1080 keyXchange: FiSH.DH1080_INIT $1
.-
.Show key :FiSH.showkey $1
.Set new key :FiSH.setkey $1 $?
.Set new key (UTF-8) :FiSH.setkey_utf8 $1 $?
.Remove key :FiSH.removekey $1
.Use same key as $chan :FiSH.usechankey $1 $chan
}
menu status,channel,nicklist,query {
FiSH
.-
.Set plain-prefix $chr(91) $readini(%blow_ini,FiSH,plain_prefix) $chr(93) :FiSH.prefix $?="Enter new plain-prefix:"
.Auto-KeyXchange $+ $chr(32) $+ %autokeyx
..Enable :set %autokeyx [On]
..Disable :set %autokeyx [Off]
.Local IP
..Set local IP now: localinfo FiSH.OWNZ $dll(%FiSH_dll,FiSH_GetMyIP,FiSH)
..Set after connecting $+ $chr(32) $+ %autoset_localip
...Enable :set %autoset_localip [On]
...Disable :set %autoset_localip [Off]
..Copy local IP to clipboard: clipboard $dll(%FiSH_dll,FiSH_GetMyIP,FiSH)
..Show local IP :FiSH.showmyip
.Misc config
..Encrypt outgoing $iif($dll(%FiSH_dll,INI_GetBool,process_outgoing 1) == 0, [Off], [On])
...Enable :writeini -n %blow_ini FiSH process_outgoing 1
...Disable :writeini -n %blow_ini FiSH process_outgoing 0
..Decrypt incoming $iif($dll(%FiSH_dll,INI_GetBool,process_incoming 1) == 0, [Off], [On])
...Enable :writeini -n %blow_ini FiSH process_incoming 1
...Disable :writeini -n %blow_ini FiSH process_incoming 0
..-
..Crypt-Mark (Incoming)
...Prefix :writeini -n %blow_ini FiSH mark_position 2
...Suffix :writeini -n %blow_ini FiSH mark_position 1
...Disable :writeini -n %blow_ini FiSH mark_position 0
..Crypt-Mark (Outgoing) $+ $chr(32) $+ %mark_outgoing
...Enable :set %mark_outgoing [On]
...Disable :set %mark_outgoing [Off]
...-
...Style 1 :{
set %mark_style 1
set %mark_outgoing [On]
}
...Style 2 :{
set %mark_style 2
set %mark_outgoing [On]
}
...Style 3 :{
set %mark_style 3
set %mark_outgoing [On]
}
..NickTracker $+ $chr(32) $+ %NickTrack
...Enable :set %NickTrack [On]
...Disable :set %NickTrack [Off]
..Encrypt NOTICE $iif($dll(%FiSH_dll,INI_GetBool,encrypt_notice) == 1, [On], [Off])
...Enable :writeini -n %blow_ini FiSH encrypt_notice 1
...Disable :writeini -n %blow_ini FiSH encrypt_notice 0
..Encrypt ACTION $iif($dll(%FiSH_dll,INI_GetBool,encrypt_action) == 1, [On], [Off])
...Enable :writeini -n %blow_ini FiSH encrypt_action 1
...Disable :writeini -n %blow_ini FiSH encrypt_action 0
..-
..Open blow.ini :run %blow_ini
..-
..FiSH 10 - based on FiSH 1.30 by RXD :run http://github.com/flakes/mirc_fish_10
}
menu channel {
FiSH
.Misc config
..Crypt-Mark (Incoming)
...-
...Only for $chan $iif($dll(%FiSH_dll,INI_GetSectionBool,$network $chan mark_encrypted $dll(%FiSH_dll,INI_GetBool,mark_encrypted)) == 0, [Off], [On])
....Enable :dll %FiSH_dll INI_SetSectionBool $network $chan mark_encrypted 1
....Disable :dll %FiSH_dll INI_SetSectionBool $network $chan mark_encrypted 0
..Encrypt TOPIC $iif($dll(%FiSH_dll,INI_GetSectionBool,$network $chan encrypt_topic 0) == 1, [On], [Off])
...Enable :dll %FiSH_dll INI_SetSectionBool $network $chan encrypt_topic 1
...Disable :dll %FiSH_dll INI_SetSectionBool $network $chan encrypt_topic 0
}
menu query {
FiSH
.Misc config
..Crypt-Mark (Incoming)
...-
...Only for $1 $iif($dll(%FiSH_dll,INI_GetSectionBool,$network $1 mark_encrypted $dll(%FiSH_dll,INI_GetBool,mark_encrypted)) == 0, [Off], [On])
....Enable :dll %FiSH_dll INI_SetSectionBool $network $1 mark_encrypted 1
....Disable :dll %FiSH_dll INI_SetSectionBool $network $1 mark_encrypted 1
..CBC key exchange $iif($dll(%FiSH_dll,INI_GetSectionBool,$network $1 dh1080_cbc 1) == 1, [On], [Off])
...Enable :dll %FiSH_dll INI_SetSectionBool $network $1 dh1080_cbc 1
...Disable :dll %FiSH_dll INI_SetSectionBool $network $1 dh1080_cbc 0
}
alias fishdebug {
var %w = @fishdebug
var %a = aline -ph %w
var %f1 = fishdebug
var %f2 = $rand(0,9999)
var %x = $iif($isfile(%FiSH_dll),$dll(%FiSH_dll,FiSH_WriteKey10,NULL %f1 %f2 HelloWorld),MISSING_DLL)
var %f10dll = $+(",$nofile($mircexe) $+ fish_10.dll,")
var %f10inj = $+(",$nofile($mircexe) $+ fish_inject.dll,")
var %f10ini = $shortfn($mircdir $+ blow.ini)
if (!$window(%w)) {
window -a %w -1 -1 550 300 Courier New 12
}
else {
clear %w
window -a %w
}
%a ---------FISH DEBUG---------
%a $cr
%a ::VERSION
%a mIRC version: $version
%a SSL version: $sslversion
%a SSL ready: $sslready
%a SSL mode: $iif($readini($mircini,ssl,load),$v1,default)
%a $cr
%a ::mIRC
%a mIRC dir: $mircdir
%a mIRC.exe: $mircexe
%a mIRC.ini: $mircini
%a Portable: $iif($readini($mircini,about,portable),$v1,NotFound)
%a $cr
%a ::Files
%a fish_10.dll: %f10dll - $isfile(%f10dll)
%a version string: $iif($isfile(%f10dll),$dll(%f10dll,FiSH_GetVersion, ),NotFound)
%a fish_inject.dll: %f10inj - $isfile(%f10inj)
%a version string: $iif($isfile(%f10inj),$dll(%f10inj,FiSH_GetInjectVersion, ),NotFound)
%a blow.ini: %f10ini - $isfile(%f10ini)
%a $cr
%a ::md5
%a fish_10.dll: $iif($md5(%f10dll,2),$v1,NotFound)
%a fish_inject.dll: $iif($md5(%f10inj,2),$v1,NotFound)
%a fish_10.mrc: $iif($md5($script,2),$v1,NotFound)
%a $cr
%a ::Variables
%a blow_ini: %blow_ini
%a FiSH_dll: %FiSH_dll
%a $cr
%a ::FiSH Debug
$dll(%f10inj,InjectDebugInfo,0)
$dll(%f10dll,NetworkDebugInfo,0)
%a $cr
%a ::Testing
%a >> Writing key to blow.ini
%a << Reading back key, you should see a 'HelloWorld' on the next line.
%a !! GetKey10: $iif($dll(%FiSH_dll,FiSH_GetKey10, %f1 %f2),$v1,NotFound)
%a << Deleting key from blow.ini
var %delkey = $dll(%FiSH_dll,FiSH_DelKey10,%f1 %f2)
}
alias -l fishdebug.clip {
clipboard
var %i = 1
while ($line(@fishdebug,%i)) {
clipboard -an $v1
inc %i
}
}
menu @fishdebug {
&Copy to Clipboard: fishdebug.clip
-
&Refresh:{ clear @fishdebug | fishdebug }
C&lose:{ window -c @fishdebug }
}