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
a914a7fb
Commit
a914a7fb
authored
11 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
For local (not publically routable) addresses, attempt to finger the nick
at the connected address.
parent
e24de6be
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/ircbots/weather/weather_functions.js
+49
-0
49 additions, 0 deletions
exec/ircbots/weather/weather_functions.js
with
49 additions
and
0 deletions
exec/ircbots/weather/weather_functions.js
+
49
−
0
View file @
a914a7fb
...
...
@@ -5,11 +5,60 @@ function get_nicklocation(srv,nick)
{
var
ret
,
geo
;
function
finger_from
()
{
var
sock
=
new
Socket
();
var
resp
=
''
;
var
m
;
sock
.
bind
(
0
,
server
.
interface_ip_address
);
if
(
sock
.
connect
(
userhost
,
"
finger
"
))
{
sock
.
send
(
nick
+
"
\r\n
"
);
while
(
sock
.
is_connected
)
{
var
line
=
sock
.
readline
();
if
(
line
)
resp
+=
line
+
"
\r\n
"
;
}
if
(
m
=
resp
.
match
(
/
\r\n
Last login .*
?\r\n
via .*
?
from .*
?
\[([^\]]
+
)\]
/
))
{
sock
.
close
();
return
m
[
1
];
}
}
sock
.
close
();
return
userhost
;
}
try
{
var
userhost
=
srv
.
users
[
nick
.
toUpperCase
()].
uh
.
replace
(
/^.*
\@
/
,
''
);
// If the hostname is not a FQDN, use the server name and replace the first element...
if
(
userhost
.
indexOf
(
'
.
'
)
==-
1
)
userhost
+=
(
srv
.
users
[
cmd
[
1
].
toUpperCase
()].
servername
.
replace
(
/^
[^\.]
+
\.
/
,
'
.
'
));
// If the address is local, finger the server for the nick and use the From:
userhost
=
resolve_ip
(
userhost
);
if
(
userhost
.
search
(
/^10
\.
/
)
!=
-
1
||
userhost
.
search
(
/^192
\.
168
\.
/
)
!=
-
1
||
userhost
.
search
(
/^172
\.
16
\.
/
)
!=
-
1
||
userhost
.
search
(
/^172
\.
17
\.
/
)
!=
-
1
||
userhost
.
search
(
/^172
\.
18
\.
/
)
!=
-
1
||
userhost
.
search
(
/^172
\.
19
\.
/
)
!=
-
1
||
userhost
.
search
(
/^172
\.
2
[
0-9
]\.
/
)
!=
-
1
||
userhost
.
search
(
/^172
\.
30
\.
/
)
!=
-
1
||
userhost
.
search
(
/^172
\.
31
\.
/
)
!=
-
1
||
(
userhost
.
search
(
/^169
\.
254
\.
/
)
!=
-
1
&&
userhost
.
search
(
/^169
\.
254
\.
0
\.
/
)
==
-
1
&&
userhost
.
search
(
/^169
\.
254
\.
255
\.
/
)
==
-
1
)
||
userhost
.
search
(
/^fc
[
0-9a-f
][
0-9a-f
]
:/
)
!=
-
1
||
userhost
.
search
(
/^fd
[
0-9a-f
][
0-9a-f
]
:/
)
!=
-
1
||
userhost
.
search
(
/^fec
[
0-9a-f
]
:/
)
!=
-
1
||
userhost
.
search
(
/^fed
[
0-9a-f
]
:/
)
!=
-
1
||
userhost
.
search
(
/^fee
[
0-9a-f
]
:/
)
!=
-
1
||
userhost
.
search
(
/^fef
[
0-9a-f
]
:/
)
!=
-
1
||
userhost
.
search
(
/^fe8
[
0-9a-f
]
:/
)
!=
-
1
||
userhost
.
search
(
/^fe9
[
0-9a-f
]
:/
)
!=
-
1
||
userhost
.
search
(
/^fea
[
0-9a-f
]
:/
)
!=
-
1
||
userhost
.
search
(
/^feb
[
0-9a-f
]
:/
)
!=
-
1
)
userhost
=
finger_from
();
geo
=
get_geoip
(
userhost
);
ret
=
geo
.
latitude
+
'
,
'
+
geo
.
longitude
;
if
(
ret
==
'
0,0
'
)
{
...
...
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