PDA

View Full Version : Offset via ASP (VBScript)



pooz
11-25-2002, 12:20 AM
My first contribution to the SEQ project, I hope someone finds it useful.

Since I saw two other offset finders posted on here I thought I'd whip one up. At first I didn't think it'd be possible with VBScript, but with a VB version up I was inspired.

It's real simple to use and plenty fast.

There's a prompt for you to browse for your eqgame.exe file and you can specify the path in the url for easy bookmarking.

example:


http://localhost/eq-offset/default.asp?path=C:\Program%20Files\EverQuest\eqga me.exe

This is meant to be served on the same machine that EQ is stored on, but it would be very easy to copy the file to be hosted somewhere else.

Comments and Suggestions would be appreciated!


Up next I'd like to write a dll in vb to be called via an asp page that will read the key from memory from the offset. VBScript cannot access memory directly, but is able to utilize dll's written in other languages that can read memory.

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


<%@ LANGUAGE = "VBSCRIPT"%>
<%Option Explicit%>
<%Response.Buffer = True%>
<%
Response.Write "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01//EN"" ""http://www.w3.org/TR/html4/strict.dtd"">" & VBCRLF

Dim objFileSystem
Dim objEQGame
Dim strEQGamePath
Dim strPath
Dim strDateLastModified
Dim strSize
Dim strType

If Request.Form("path") <> "" Then
strEQGamePath = Request.Form("path")
ElseIf Request.QueryString("path") <> "" Then
strEQGamePath = Request.QueryString("path")
Else
strEQGamePath = Null
End If

Private Function UStr2Bstr(UStr)
Dim lngLoop
For lngLoop = 1 to Len(UStr)
UStr2Bstr = UStr2Bstr & ChrB(Asc(Mid(UStr, lngLoop, 1)))
Next
End Function

Private Function BinToHex(strWord)
Dim intByteCounter
Dim strHextor
For intByteCounter = LenB(binMemoryAddr) To 1 Step -1
strHextor = Hex(AscB(MidB(binMemoryAddr, intByteCounter, 1)))
If Len(strHextor) = 1 Then
strHextor = "0" & strHextor
End If
BinToHex = BinToHex & strHextor
Next
strHextor = Empty
intByteCounter = Empty
End Function


If Not IsNull(strEQGamePath) Then

' Get File Info First (Path, Size, Modified Date

Set objFileSystem = Server.CreateObject("Scripting.FileSystemObject")
If objFileSystem.FileExists(strEQGamePath) Then
Set objEQGame = objFileSystem.GetFile(strEQGamePath)
strPath = objEQGame.Path
strDateLastModified = objEQGame.DateLastModified
strSize = objEQGame.Size
strType = objEQGame.Type
Else
Set objFileSystem = Nothing
Response.Redirect "default.asp?error=badfile"
End If

' Clean Up File and FileSystem objects

Set objEQGame = Nothing
Set objFileSystem = Nothing

' Now we find open the file as a Binary stream,
' Put Binary data into a byte array and
' Close the Stream to free up resources.

Dim objStream
Dim binEQGame

Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = adTypeBinary
objStream.Open
objStream.LoadFromFile(strEQGamePath)
binEQGame = objStream.Read

objStream.Close
Set objStream = Nothing

' Create the pattern to search for

Dim strSearchVal
Dim binAddrPos
Dim binMemoryAddr
Dim hexMemoryAddr

strSearchVal = Chr(&HC1) & Chr(&HE0) & Chr(&H8) & Chr(&H99) & Chr(&H9) & Chr(&H5)

binAddrPos = InStrB(1, binEQGame, UStr2BStr(strSearchVal))

strSearchVal = Empty

binMemoryAddr = MidB(binEQGame, binAddrPos + 6, 4)

binEQGame = Empty
binAddrPos = Empty

hexMemoryAddr = "0x" & BinToHex(binMemoryAddr)

binMemoryAddr = Empty
End If%>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>EQ-Offset</title>
</head>
<body>
<%If Not IsNull(strEQGamePath) Then%>
<p>
Filename: <%=strPath%><br>
Size: <%=strSize%> bytes<br>
Last Modified: <%=strDateLastModified%><br>
Offset: <%=hexMemoryAddr%><br>
</p>
<%End If%>
<form action="default.asp" method="post">
<p><input type="file" name="path" size="50" maxlength="255"><br><br>
<input type="submit" name="submit" value="Get Offset"></p>
</form>
<%If Request.QueryString("error") = "badfile" Then
Response.Write "<p>File does not exist.</p>"
End IF%>
</body>
</html>