Last active
August 19, 2024 11:48
-
-
Save m0rb/ddf870c0155db2ab004a8fc11e4ac230 to your computer and use it in GitHub Desktop.
vnclotto.pl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
# vnclotto.pl - a vncresolver client bot for Bluesky | |
# | |
# https://bsky.app/profile/vnclotto.misentropic.com | |
use lib "."; | |
use MyLib::ATProto qw(post_media); | |
use JSON::Parse qw(:all); | |
use LWP::UserAgent; | |
use DateTime; | |
use utf8; | |
my $url ="https://computernewb.com/vncresolver/api/scans/vnc/"; | |
my $ua = LWP::UserAgent->new(); | |
my $content = $ua->get($url."random"); or die; | |
my $js = JSON::Parse->new(); | |
$js->upgrade_utf8(1); | |
my $json = $js->parse($content->{_content}) or die; | |
my ($outbuf,$id,$ip,$port,$hostname,$asn,$createdat,$clientname,$country, | |
$city,$state) = (undef,$json->{id},$json->{ip},$json->{port}, | |
$json->{hostname},$json->{asn},$json->{createdat}, | |
$json->{clientname},$json->{country},$json->{city}, | |
$json->{state}); | |
my $date = DateTime->from_epoch(epoch=>substr($createdat,0,-5)); | |
my $shot = $ua->get($url."screenshot/".$id) or die; | |
open(my $FH,">","tmpbuf.jpg"); | |
binmode $FH; | |
print $FH $shot->{_content}; | |
close $FH; | |
($id) ? $outbuf .= "ID: ".$id."\n" : undef; | |
($ip) ? $outbuf .= "IP: ".$ip.":".$port."\n" : undef; | |
($hostname) ? $outbuf .= "Hostname: ".$hostname."\n" : undef; | |
($asn) ? $outbuf .= "ASN: ".$asn."\n" : undef; | |
($country) ? $outbuf .= "Country: ".$country."\n" : undef; | |
($city) ? $outbuf .= "City: ".$city."\n" : undef; | |
($state) ? $outbuf .= "State: ".$state."\n" : undef; | |
($clientname) ? $outbuf .= "Client: ".$clientname."\n" : undef; | |
if (length $outbuf <= 280) { | |
($date) ? $outbuf .= "Added: ".$date."\n" : undef; | |
} | |
if (length $outbuf <= 280) { | |
$outbuf .= "https://computernewb.com/vncresolver/browse/#id/".$id; | |
} | |
post_media({ account => "vnc", text => $outbuf, alt => $outbuf, fn => "tmpbuf.jpg" }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment