Help to fix WhoIs bot
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Help to fix WhoIs bot

Started by jsjen, 25 March, 2004, 12:37:19

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jsjen

It didnt work so I played with it and tried to get the syntax errors out :S

I hope someone can get it to work for us

---------------------


sBotName = "Whois"

function Main()
  --sBotName = "Whois"
  frmHub.RegisterBotName(sBotName)
end

function DataArival (curUser, sCurData)
  if curUser.bOperator and (Left(sCurData,1)=="<" or Left(sCurData,Len(sBotName)+6)=="$To: "+sBotName+" ") then
    s=LCase(Mid(CStr(sCurData),inStr(CStr(sCurData),">")+2))
    if InStr(s," ") then
      sCmd=Left(s,InStr(s," ")-1)
      sUser=Mid(s,InStr(s," ")+1)
    else
      sCmd=s
      sUser=curUser.sName
    end
    if sCmd=="whois" then
      if bIsIP(sUser) then
        curUser.PrivateMessage(CStr(sBotName),"Whois information about IP "+cStr(sUser)+cStr(sWhois(sUser)))
      else
        if colUsers.Online(CStr(sUser)) then
          curUser.PrivateMessage(cStr(sBotName),"Whois information about user "+cStr(sUser)+" ("+cStr(colUsers.ItemByName(CStr(sUser)).IP)+")"+cStr(sWhois(colUsers.ItemByName(CStr(sUser)).IP)))
        else
          curUser.PrivateMessage(cStr(sBotName),"User "+cStr(sUser)+" is not online.")
        end
      end
    end
  end
end

function bIsIP(sIP)
  bIsIP=False
  i=0
  for j = 1,Len(CStr(sIP)) do
    if (Asc(Mid(CStr(sIP),j,1))<48 or Asc(Mid(CStr(sIP),j,1))>57) and Asc(Mid(CStr(sIP),j,1))~=46 then
   i = 9
    end
    if Asc(Mid(CStr(sIP), j, 1)) == 46 then
   i = i + 1
    end
  end
  if i==3 then
   bIsIP=True
  end
end

function sWhois(sIP)
  oSrvHTTP = CreateObject("MSXML2.ServerXMLHTTP")
  oSrvHTTP.open("GET","http://www.ripe.net/perl/whois?searchtext="+sIP+"&alt_database=ALL", False)
  oSrvHTTP.Send()
  sRes = oSrvHTTP.responsetext
  oSrvHTTP = Nothing
  sRes=Mid(sRes,InStr(sRes,"
")+11)
  sRes=Left(sRes,InStrRev(sRes,"
")-2)
  sRes=Replace(sRes,chr(10),vbCRLF)
  sRes=Replace(sRes,"
",vbCRLF)
  sRes=Replace(sRes,"    "," ")
  sRes=Replace(sRes,"   "," ")
  sRes=Replace(sRes,"  "," ")
  sRes=Replace(sRes,": ",":"+vbTab+vbTab)
  sRes=Replace(sRes,"mnt-routes:"+vbTab,"mnt-routes:")
  sRes=Replace(sRes,"mnt-lower:"+vbTab,"mnt-lower:")
  sWhois=vbCRLF
  iZ=True
  for i=1,Len(sRes) do
    if Mid(sRes,i,1)=="<" then
     iZ=False
    end
    if iZ then
     sWhois=sWhois+Mid(sRes,i,1)
    end
    if Mid(sRes,i,1)==">" then
     iZ=True
    end
  end
end
------------------------------------

pHaTTy

looks more like a script from sdch, but if u post the version b4 u edited, i will fix the rest, im short on time.....
Resistance is futile!

pHaTTy

in fact try this

sBotName = "Whois" 

function Main() 
	sBotName = "Whois" 
	frmHub.RegisterBotName(sBotName) 
end 

function DataArival (curUser, sCurData) 
	if curUser.bOperator and (Left(sCurData,1)=="<" or Left(sCurData,Len(sBotName)+9)=="$To: "..sBotName) then 
		s=LCase(Mid(CStr(sCurData),inStr(CStr(sCurData),">")+2)) 
		if InStr(s," ") then 
			sCmd=Left(s,InStr(s," ")-1) 
			sUser=Mid(s,InStr(s," ")+1) 
		else 
			sCmd=s 
			sUser=curUser.sName 
		end 
		if sCmd=="whois" then 
			if bIsIP(sUser) then 
				curUser.PrivateMessage(CStr(sBotName),"Whois information about IP "..cStr(sUser)..cStr(sWhois(sUser))) 
			else 
				if colUsers.Online(CStr(sUser)) then 
					curUser.PrivateMessage(cStr(sBotName),"Whois information about user "..cStr(sUser)..(cStr(colUsers.ItemByName(CStr(sUser)).IP))..cStr(sWhois(colUsers.ItemByName(CStr(sUser)).IP))) 
				else 
					curUser.PrivateMessage(cStr(sBotName),"User "..cStr(sUser).." is not online.") 
				end 
			end 
		end 
	end 
end 

function bIsIP(sIP) 
	bIsIP=False 
	i=0 
	for j = 1,Len(CStr(sIP)) do 
		if (Asc(Mid(CStr(sIP),j,1))<48 or Asc(Mid(CStr(sIP),j,1))>57) and Asc(Mid(CStr(sIP),j,1))~=46 then 
			i = 9 
		end 
		if Asc(Mid(CStr(sIP), j, 1)) == 46 then 
			i = i + 1 
		end 
	end 
	if i==3 then 
		bIsIP=True 
	end 
end 

function sWhois(sIP) 
	oSrvHTTP = CreateObject("MSXML2.ServerXMLHTTP") 
	oSrvHTTP.open("GET","http://www.ripe.net/perl/whois?searchtext="..sIP.."&alt_database=ALL", False) 
	oSrvHTTP.Send() 
	sRes = oSrvHTTP.responsetext 
	oSrvHTTP = Nothing 
	sRes=Mid(sRes,InStr(sRes,"
")+11) 
	sRes=Left(sRes,InStrRev(sRes,"
")-2)
sRes=Replace(sRes,chr(10),vbCRLF)
sRes=Replace(sRes,"
",vbCRLF) 
	sRes=Replace(sRes," "," ") 
	sRes=Replace(sRes," "," ") 
	sRes=Replace(sRes," "," ") 
	sRes=Replace(sRes,": ",":"..vbTab..vbTab) 
	sRes=Replace(sRes,"mnt-routes:"..vbTab,"mnt-routes:") 
	sRes=Replace(sRes,"mnt-lower:"..vbTab,"mnt-lower:") 
	sWhois=vbCRLF 
	iZ=True 
	for i=1,Len(sRes) do 
		if Mid(sRes,i,1)=="<" then 
			iZ=False 
		end 
		if iZ then 
			sWhois=sWhois+Mid(sRes,i,1) 
		end 
		if Mid(sRes,i,1)==">" then 
			iZ=True 
		end 
	end 
end
Resistance is futile!

SMF spam blocked by CleanTalk