TuMTuM
Joined: 17 Feb 2002
Posts: 425
|
Posted: 07-23-2003 03:50 PM Post subject: Isonews NFO viewer source code |
|
|
Had nothing better to do, so decompiled isonews nfo viewer source:
Code:
import java.applet.Applet;
import java.awt.*;
import java.awt.image.ImageObserver;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.net.URL;
import java.util.zip.CRC32;
public class NFO extends Applet
implements ImageObserver, Runnable
{
static Image gifFont;
static int charWidth;
static int charHeight;
static boolean imgLoad;
boolean nfoLoad;
boolean drawn;
String rows[];
int scrollrow;
int totalrows;
Graphics gOff;
Image offScreen;
Color backClr;
String displayMessage;
public boolean imageUpdate(Image image, int i, int j, int k, int l, int i1)
{
if((i & 0x20) == 32)
{
imgLoad = true;
charWidth = l / 256;
charHeight = i1;
repaint();
}
return true;
}
public void init()
{
setMsg("Loading...");
backClr = new Color(255, 255, 255);
if(!imgLoad)
{
URL url = getCodeBase();
gifFont = getImage(url, "font.gif");
}
}
public void setMsg(String s)
{
if(s == null)
{
displayMessage = "null";
return;
} else
{
displayMessage = s;
return;
}
}
public void start()
{
drawn = false;
nfoLoad = false;
byte abyte0[] = new byte[100];
setMsg("Loading...");
byte byte0 = 19;
Object aobj[] = new String[byte0 + 1];
aobj[0] = "www.isonews.com";
aobj[1] = "www.isonews.nu";
aobj[2] = "www.isonews.dk";
aobj[3] = "205.134.182.35";
aobj[4] = "lust.ai.net";
aobj[5] = "steve.mine.nu";
aobj[6] = "localhost";
aobj[7] = "www.isonews.net";
aobj[8] = "www.isonews.org";
aobj[9] = "isonews.com";
aobj[10] = "isonews.net";
aobj[11] = "isonews.org";
aobj[12] = "www.divxnews.com";
aobj[13] = "www.divxnews.org";
aobj[14] = "www.divxnews.net";
aobj[15] = "divxnews.com";
aobj[16] = "divxnews.net";
aobj[17] = "divxnews.org";
aobj[18] = "205.134.182.43";
int ai[] = new int[byte0 + 1];
ai[0] = 0x2936d4e9;
ai[1] = 0xe8bb8605;
ai[2] = 0xe85b53ec;
ai[3] = 0x1ecc26ff;
ai[4] = 0x5530457;
ai[5] = 0x97882b3;
ai[6] = 0xdec20823;
ai[7] = 0xff6a07f0;
ai[8] = 0x3f95a88f;
ai[9] = 0xf11ad8eb;
ai[10] = 0x27460bf2;
ai[11] = 0xe7b9a48d;
ai[12] = 0xa0251c3;
ai[13] = 0x1ca12da5;
ai[14] = 0xdc5e82da;
ai[15] = 0xe4941ce3;
ai[16] = 0x32c8cffa;
ai[17] = 0xf2376085;
ai[18] = 0xf8ee150d;
int ai1[] = new int[byte0 + 1];
ai1[0] = -76;
ai1[1] = -52;
ai1[2] = -72;
ai1[3] = -804;
ai1[4] = -115;
ai1[5] = -108;
ai1[6] = -8;
ai1[7] = -68;
ai1[8] = -67;
ai1[9] = -51;
ai1[10] = -43;
ai1[11] = -42;
ai1[12] = -65;
ai1[13] = -56;
ai1[14] = -57;
ai1[15] = -49;
ai1[16] = -41;
ai1[17] = -40;
ai1[18] = -805;
int j1 = 0xf2d37036;
String s2 = "onenineteenninetyeight";
String s3 = "0";
int j2 = 0;
int k2 = 0;
CRC32 crc32 = new CRC32();
byte abyte1[] = new byte[s2.length()];
s2.getBytes(0, s2.length(), abyte1, 0);
crc32.reset();
crc32.update(abyte1, 0, s2.length());
int i2 = (int)crc32.getValue() % 0x40000000;
int i;
for(i = 0; i < byte0; i++)
{
if(!aobj[i].equals(getCodeBase().getHost()))
{
continue;
}
s3 = aobj[i];
j2 = ai1[i];
k2 = ai[i];
break;
}
boolean flag;
if(i == byte0)
{
flag = false;
} else
{
byte abyte2[] = new byte[s3.length()];
s3.getBytes(0, s3.length(), abyte2, 0);
crc32.reset();
crc32.update(abyte2, 0, s3.length());
int l1 = (int)crc32.getValue() % 0x40000000;
int k1 = 0;
for(i = 0; i < s3.length(); i++)
{
k1 += s3.charAt(i) - s2.charAt(s2.length() - (1 + i));
}
if(l1 != k2)
{
flag = false;
} else
if(j2 != k1)
{
flag = false;
} else
if(i2 != j1)
{
flag = false;
} else
if(!s3.equals(getCodeBase().getHost()))
{
flag = false;
} else
if(!s3.equals(getDocumentBase().getHost()))
{
flag = false;
} else
{
flag = true;
}
}
if(!flag)
{
setMsg("Sorry, this applet can only be used from and on files from [url]www.isonews.com[/url]");
return;
}
String s = getParameter("COLOR");
if(s == null)
{
backClr = new Color(255, 255, 255);
} else
{
if(s.charAt(0) == '#')
{
s = s.substring(1, s.length());
}
int k = Integer.parseInt(s, 16);
backClr = new Color((k & 0xff0000) >> 16, (k & 0xff00) >> 8, k & 0xff);
}
s = getParameter("NFO");
if(s == null)
{
setMsg("No NFO Specified...");
return;
}
Socket socket;
try
{
socket = new Socket(getCodeBase().getHost(), 80);
}
catch(Exception exception)
{
setMsg("Could not connect to host: " + exception.toString());
return;
}
InputStream inputstream;
try
{
inputstream = socket.getInputStream();
}
catch(Exception exception1)
{
setMsg("Could not setup read: " + exception1.toString());
return;
}
OutputStream outputstream;
try
{
outputstream = socket.getOutputStream();
}
catch(Exception exception2)
{
setMsg("Could not setup write: " + exception2.toString());
return;
}
String s1 = new String("GET " + s + " HTTP/1.0\naccept: */*\nuser-agent: steve's nfo applet 1.0\n\n");
aobj = new byte[s1.length()];
s1.getBytes(0, s1.length(), ((byte []) (aobj)), 0);
try
{
outputstream.write(((byte []) (aobj)), 0, s1.length());
}
catch(Exception exception3)
{
setMsg("Could not write request: " + exception3.toString());
return;
}
rows = new String[1024];
i = 0;
for( totalrows = -1; totalrows < 1024; )
{
int j;
try
{
j = inputstream.read();
}
catch(Exception _ex)
{
j = -1;
}
if(j == -1)
{
break;
}
if(j == 10)
{
if(totalrows >= 0)
{
rows[totalrows] = new String(abyte0, 0, 0, i);
totalrows++;
}
if(totalrows < 0 && i == 0)
{
totalrows = 0;
}
i = 0;
} else
if(j != 13)
{
if(i == 80 && totalrows >= 0)
{
rows[totalrows] = new String(abyte0, 0, 0, i);
totalrows++;
i = 0;
}
if(j == 9)
{
int i1 = i % 8;
if(i1 == 0)
{
i1 = 8;
}
for(int l = 0; l < i1; l++)
{
abyte0[i + l] = 32;
}
i += i1;
} else
{
abyte0[i] = (byte)j;
i++;
}
}
}
rows[totalrows] = new String(abyte0, 0, 0, i);
totalrows++;
nfoLoad = true;
repaint();
}
public void update(Graphics g)
{
paint(g);
}
public void run()
{
}
public void stop()
{
drawn = false;
nfoLoad = false;
gOff = null;
offScreen = null;
}
public void drawString(Graphics g, int i, int j, String s)
{
for(int k = 0; k < s.length(); k++)
{
char c = s.charAt(k);
g.drawImage(gifFont, i + k * charWidth, j, i + k * charWidth + charWidth, j + charHeight, c * charWidth, 0, c * charWidth + charWidth, charHeight, this);
}
}
public void paint(Graphics g)
{
if(nfoLoad && imgLoad)
{
if(!drawn)
{
offScreen = createImage(charWidth * 80, charHeight * totalrows);
gOff = offScreen.getGraphics();
gOff.setColor(backClr);
gOff.fillRect(0, 0, charWidth * 80, charHeight * totalrows);
for(int i = scrollrow; i < totalrows; i++)
{
drawString(gOff, 0, i * charHeight, rows[i]);
}
drawn = true;
}
g.drawImage(offScreen, 0, 0, null);
g.setColor(backClr);
if(size().width > charWidth * 80)
{
g.fillRect(charWidth * 80, 0, size().width, size().height);
}
if(size().height > charHeight * totalrows)
{
g.fillRect(0, charHeight * totalrows, size().width, size().height);
return;
}
} else
{
if(displayMessage != null)
{
g.drawString(displayMessage, 10, 10);
}
g.drawImage(gifFont, 0, 0, 1, 1, 0, 0, 1530, 8, this);
}
}
public NFO()
{
}
}
and there is http://theisonews.com/font.gif |
|