Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
dbf40d5a
Commit
dbf40d5a
authored
13 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Support Canadian call signs as well and include more detail for US signs.
parent
1ca26faf
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/ircbots/ham/ham.js
+92
-23
92 additions, 23 deletions
exec/ircbots/ham/ham.js
with
92 additions
and
23 deletions
exec/ircbots/ham/ham.js
+
92
−
23
View file @
dbf40d5a
if
(
!
js
.
global
||
js
.
global
.
HTTPRequest
==
undefined
)
if
(
!
js
.
global
||
js
.
global
.
HTTPRequest
==
undefined
)
load
(
"
http.js
"
);
load
(
"
http.js
"
);
//Bot_Commands={};
//function Bot_Command(x,y,z){}
Bot_Commands
[
"
CALLSIGN
"
]
=
new
Bot_Command
(
0
,
false
,
false
);
Bot_Commands
[
"
CALLSIGN
"
]
=
new
Bot_Command
(
0
,
false
,
false
);
Bot_Commands
[
"
CALLSIGN
"
].
command
=
function
(
target
,
onick
,
ouh
,
srv
,
lvl
,
cmd
)
{
Bot_Commands
[
"
CALLSIGN
"
].
command
=
function
(
target
,
onick
,
ouh
,
srv
,
lvl
,
cmd
)
{
var
callsign
;
var
callsign
;
...
@@ -21,35 +24,101 @@ Bot_Commands["CALLSIGN"].command = function (target,onick,ouh,srv,lvl,cmd) {
...
@@ -21,35 +24,101 @@ Bot_Commands["CALLSIGN"].command = function (target,onick,ouh,srv,lvl,cmd) {
return
true
;
return
true
;
}
}
var
CookieRequest
=
new
HTTPRequest
;
function
USCallsign
(
callsign
,
srv
,
target
)
{
var
m
=
CookieRequest
.
Get
(
'
http://wireless2.fcc.gov/UlsApp/UlsSearch/searchLicense.jsp
'
);
var
i
;
var
jsess
=
''
;
var
CookieRequest
=
new
HTTPRequest
();
var
cookies
=
[
'
refineIndex=0
'
];
var
m
=
CookieRequest
.
Get
(
'
http://wireless2.fcc.gov/UlsApp/UlsSearch/searchLicense.jsp
'
);
for
(
i
in
CookieRequest
.
response_headers
)
{
var
jsess
=
''
;
if
(
CookieRequest
.
response_headers
[
i
].
search
(
/^Set-Cookie:/i
)
!=-
1
)
{
var
cookies
=
[
'
refineIndex=0
'
];
if
(
m
=
CookieRequest
.
response_headers
[
i
].
match
(
/^Set-Cookie:
\s
*
(
.*
?)
;/
))
{
for
(
i
in
CookieRequest
.
response_headers
)
{
cookies
.
push
(
m
[
1
]);
if
(
CookieRequest
.
response_headers
[
i
].
search
(
/^Set-Cookie:/i
)
!=-
1
)
{
if
(
m
[
1
].
search
(
/JSESSIONID_/
)
==
0
)
if
(
m
=
CookieRequest
.
response_headers
[
i
].
match
(
/^Set-Cookie:
\s
*
(
.*
?)
;/
))
{
jsess
=
m
[
1
];
cookies
.
push
(
m
[
1
]);
if
(
m
[
1
].
search
(
/JSESSIONID_/
)
==
0
)
jsess
=
m
[
1
];
}
}
}
req
=
new
HTTPRequest
();
req
.
SetupPost
(
'
http://wireless2.fcc.gov/UlsApp/UlsSearch/results.jsp;
'
+
jsess
,
undefined
,
undefined
,
'
fiUlsSearchByType=uls_l_callsign++++++++++++++++&fiUlsSearchByValue=
'
+
callsign
+
'
&fiUlsExactMatchInd=Y&hiddenForm=hiddenForm&jsValidated=true&x=0&y=0
'
);
req
.
request_headers
.
push
(
"
Cookie:
"
+
cookies
.
join
(
'
;
'
));
req
.
request_headers
.
push
(
"
Referer: http://wireless2.fcc.gov/UlsApp/UlsSearch/searchLicense.jsp
"
);
req
.
SendRequest
();
req
.
ReadResponse
();
m
=
req
.
body
.
match
(
/
(
license.jsp
\?
licKey=
[^\s]
*
)
/
);
if
(
m
)
{
var
response
=
new
HTTPRequest
().
Get
(
'
http://wireless2.fcc.gov/UlsApp/UlsSearch/
'
+
m
[
1
]);
m
=
response
.
match
(
/In the case of City, state and zip
[^
-
]
*
?
-->
([\x
00-
\x
ff
]
*
?)
<
\/
td>/
);
if
(
m
)
{
var
info
=
callsign
+
'
:
'
;
m
[
1
]
=
m
[
1
].
replace
(
/<
[^
>
]
*>/g
,
''
);
m
[
1
]
=
m
[
1
].
replace
(
/
[\r\n]
/g
,
'
'
);
m
[
1
]
=
m
[
1
].
replace
(
/
\s
+/g
,
'
'
);
info
+=
m
[
1
];
m
=
response
.
match
(
/>Type<
\/
td>
[\x
00-
\x
ff
]
*
?
>
([^
<&
]
*
)[
<&
]
/
);
if
(
m
)
{
m
[
1
]
=
m
[
1
].
replace
(
/<
[^
>
]
*>/g
,
''
);
m
[
1
]
=
m
[
1
].
replace
(
/
[\r\n]
/g
,
'
'
);
m
[
1
]
=
m
[
1
].
replace
(
/
\s
+/g
,
'
'
);
info
+=
'
- Type:
'
+
m
[
1
];
}
m
=
response
.
match
(
/<!--Example: Amateur Extra -->
([^
&<
]
*
?)[
&<
]
/
);
if
(
m
)
{
m
[
1
]
=
m
[
1
].
replace
(
/<
[^
>
]
*>/g
,
''
);
m
[
1
]
=
m
[
1
].
replace
(
/
[\r\n]
/g
,
'
'
);
m
[
1
]
=
m
[
1
].
replace
(
/
\s
+/g
,
'
'
);
info
+=
'
- Class:
'
+
m
[
1
];
}
m
=
response
.
match
(
/>Status<
\/
td>
[\x
00-
\x
ff
]
*
?
>
([^
<&
]
*
)[
<&
]
/
);
if
(
m
)
{
m
[
1
]
=
m
[
1
].
replace
(
/<
[^
>
]
*>/g
,
''
);
m
[
1
]
=
m
[
1
].
replace
(
/
[\r\n]
/g
,
'
'
);
m
[
1
]
=
m
[
1
].
replace
(
/
\s
+/g
,
'
'
);
info
+=
'
(
'
+
m
[
1
]
+
'
)
'
;
}
srv
.
o
(
target
,
info
);
}
else
{
srv
.
o
(
target
,
"
Unable to parse US callsign info!
"
);
}
}
}
}
else
{
srv
.
o
(
target
,
"
Unable to match US callsign!
"
);
}
}
function
CanadaCallsign
(
callsign
,
srv
,
target
)
{
var
result
=
new
HTTPRequest
().
Post
(
'
http://www.callsign.ca/ind.php
'
,
'
indicatif=
'
+
callsign
);
var
m
=
result
.
match
(
/<H5>
\s
*
([\x
00-
\x
ff
]
*
?)
<
\/
H5/
);
if
(
m
!=
null
)
{
m
[
1
]
=
m
[
1
].
replace
(
/<
[^
>
]
*>/g
,
''
);
m
[
1
]
=
m
[
1
].
replace
(
/
[\r\n]
/g
,
'
'
);
m
[
1
]
=
m
[
1
].
replace
(
/
\s
+/g
,
'
'
);
srv
.
o
(
target
,
m
[
1
]);
}
else
{
srv
.
o
(
target
,
"
Unable to match Canadian callsign!
"
);
}
}
if
(
callsign
.
search
(
/
(
C
[
F-K
]
|C
[
Y-Z
]
|V
[
A-GOXY
]
|X
[
J-O
])
/
)
==
0
)
{
CanadaCallsign
(
callsign
,
srv
,
target
);
}
}
req
=
new
HTTPRequest
();
else
if
(
callsign
.
search
(
/
(
A
[
A-L
]
|K|N|W
)
/
)
==
0
)
{
req
.
SetupPost
(
'
http://wireless2.fcc.gov/UlsApp/UlsSearch/results.jsp;
'
+
jsess
,
undefined
,
undefined
,
'
fiUlsSearchByType=uls_l_callsign++++++++++++++++&fiUlsSearchByValue=
'
+
callsign
+
'
&fiUlsExactMatchInd=Y&hiddenForm=hiddenForm&jsValidated=true&x=0&y=0
'
);
USCallsign
(
callsign
,
srv
,
target
);
req
.
request_headers
.
push
(
"
Cookie:
"
+
cookies
.
join
(
'
;
'
));
req
.
request_headers
.
push
(
"
Referer: http://wireless2.fcc.gov/UlsApp/UlsSearch/searchLicense.jsp
"
);
req
.
SendRequest
();
req
.
ReadResponse
();
//m=req.body.match(/<a href=license.jsp\?.*?>\s*([^<]+)<.*?nowrap>\s*(^[<]*?)\s*<.*?nowrap>\s*(^[<]*?)\s*<.*?nowrap>\s*(^[<]*?)\s*<.*?nowrap>\s*(^[<]*?)\s*<.*?nowrap>\s*(^[<]*?)\s*</);
m
=
req
.
body
.
match
(
/<a href=license.jsp
\?
.*
?
>
\s
*
([^
<
]
+
)\s
*<
[\x
00-
\x
ff
]
*
?
nowrap>
\s
*
([^
<
]
*
?)\s
*<
[\x
00-
\x
ff
]
*
?
nowrap>
\s
*
([^
<
]
*
?)\s
*<
[\x
00-
\x
ff
]
*
?
nowrap>
\s
*
([^
<
]
*
?)\s
*<
[\x
00-
\x
ff
]
*
?
nowrap>
\s
*
([^
<
]
*
?)\s
*<
[\x
00-
\x
ff
]
*
?
nowrap>
\s
*
([^
<
]
*
?)\s
*</
);
if
(
m
)
{
srv
.
o
(
target
,
callsign
+
"
is :
"
+
m
[
2
]
+
"
-
"
+
m
[
5
]
+
"
, Expiry:
"
+
m
[
6
]);
}
}
else
{
else
{
srv
.
o
(
target
,
"
Unable to match callsign!
"
);
srv
.
o
(
target
,
"
Callsign country not supported.
"
);
}
}
return
true
;
return
true
;
}
}
//var dumb={o:function(x,y) {log(y);}};
//Bot_Commands["CALLSIGN"].command(undefined, undefined, undefined,dumb,undefined,['asdf','kj6pxy']);
//Bot_Commands["CALLSIGN"].command(undefined, undefined, undefined,dumb,undefined,['asdf','va6rrx']);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment