123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455 |
- /*** Eclipse Class Decompiler plugin, copyright (c) 2016 Chen Chao (cnfree2000@hotmail.com) ***/
- package DBstep;
- import java.io.ByteArrayInputStream;
- import java.io.ByteArrayOutputStream;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.FileOutputStream;
- import java.io.RandomAccessFile;
- import java.io.UnsupportedEncodingException;
- import javax.servlet.ServletInputStream;
- import javax.servlet.ServletOutputStream;
- import javax.servlet.ServletRequest;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- public class iMsgServer2000 {
- private String _$287 = "DBSTEP V3.0";
- private String _$288 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
- private File _$289;
- private String _$290 = new String();
- private String _$291 = new String();
- private String _$292 = new String();
- private int _$293 = 0;
- private String _$294;
- public int BuffSize = 100;
- public boolean CryptFile = false;
- public String Charset = "GB2312";
- static final int S11 = 7;
- static final int S12 = 12;
- static final int S13 = 17;
- static final int S14 = 22;
- static final int S21 = 5;
- static final int S22 = 9;
- static final int S23 = 14;
- static final int S24 = 20;
- static final int S31 = 4;
- static final int S32 = 11;
- static final int S33 = 16;
- static final int S34 = 23;
- static final int S41 = 6;
- static final int S42 = 10;
- static final int S43 = 15;
- static final int S44 = 21;
- static final byte[] PADDING = new byte[] { -128, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- private long[] _$315 = new long[4];
- private long[] _$316 = new long[2];
- private byte[] _$317 = new byte[64];
- private String _$318;
- private byte[] _$319 = new byte[16];
- private String _$320(String inbuf) {
- this._$322();
- this._$323(inbuf.getBytes(), inbuf.length());
- this._$325();
- this._$318 = "";
- for (int i = 0; i < 16; ++i) {
- this._$318 = this._$318 + _$327(this._$319[i]);
- }
- return this._$318;
- }
- private void _$322() {
- this._$316[0] = 0L;
- this._$316[1] = 0L;
- this._$315[0] = 1732584193L;
- this._$315[1] = 4023233417L;
- this._$315[2] = 2562383102L;
- this._$315[3] = 271733878L;
- }
- private long _$328(long x, long y, long z) {
- return x & y | ~x & z;
- }
- private long _$332(long x, long y, long z) {
- return x & z | y & ~z;
- }
- private long _$333(long x, long y, long z) {
- return x ^ y ^ z;
- }
- private long _$334(long x, long y, long z) {
- return y ^ (x | ~z);
- }
- private long _$335(long a, long b, long c, long d, long x, long s, long ac) {
- a += this._$328(b, c, d) + x + ac;
- a = (long) ((int) a << (int) s | (int) a >>> (int) (32L - s));
- a += b;
- return a;
- }
- private long _$342(long a, long b, long c, long d, long x, long s, long ac) {
- a += this._$332(b, c, d) + x + ac;
- a = (long) ((int) a << (int) s | (int) a >>> (int) (32L - s));
- a += b;
- return a;
- }
- private long _$343(long a, long b, long c, long d, long x, long s, long ac) {
- a += this._$333(b, c, d) + x + ac;
- a = (long) ((int) a << (int) s | (int) a >>> (int) (32L - s));
- a += b;
- return a;
- }
- private long _$344(long a, long b, long c, long d, long x, long s, long ac) {
- a += this._$334(b, c, d) + x + ac;
- a = (long) ((int) a << (int) s | (int) a >>> (int) (32L - s));
- a += b;
- return a;
- }
- private void _$323(byte[] inbuf, int inputLen) {
- byte[] block = new byte[64];
- int index = (int) (this._$316[0] >>> 3) & 63;
- if ((this._$316[0] += (long) (inputLen << 3)) < (long) (inputLen << 3)) {
- ++this._$316[1];
- }
- this._$316[1] += (long) (inputLen >>> 29);
- int partLen = 64 - index;
- int i;
- if (inputLen >= partLen) {
- this._$349(this._$317, inbuf, index, 0, partLen);
- this._$350(this._$317);
- for (i = partLen; i + 63 < inputLen; i += 64) {
- this._$349(block, inbuf, 0, i, 64);
- this._$350(block);
- }
- index = 0;
- } else {
- i = 0;
- }
- this._$349(this._$317, inbuf, index, i, inputLen - i);
- }
- private void _$325() {
- byte[] bits = new byte[8];
- this._$353(bits, this._$316, 8);
- int index = (int) (this._$316[0] >>> 3) & 63;
- int padLen = index < 56 ? 56 - index : 120 - index;
- this._$323(PADDING, padLen);
- this._$323(bits, 8);
- this._$353(this._$319, this._$315, 16);
- }
- private void _$349(byte[] output, byte[] input, int outpos, int inpos,
- int len) {
- for (int i = 0; i < len; ++i) {
- output[outpos + i] = input[inpos + i];
- }
- }
- private void _$350(byte[] block) {
- long a = this._$315[0];
- long b = this._$315[1];
- long c = this._$315[2];
- long d = this._$315[3];
- long[] x = new long[16];
- this._$359(x, block, 64);
- a = this._$335(a, b, c, d, x[0], 7L, 3614090360L);
- d = this._$335(d, a, b, c, x[1], 12L, 3905402710L);
- c = this._$335(c, d, a, b, x[2], 17L, 606105819L);
- b = this._$335(b, c, d, a, x[3], 22L, 3250441966L);
- a = this._$335(a, b, c, d, x[4], 7L, 4118548399L);
- d = this._$335(d, a, b, c, x[5], 12L, 1200080426L);
- c = this._$335(c, d, a, b, x[6], 17L, 2821735955L);
- b = this._$335(b, c, d, a, x[7], 22L, 4249261313L);
- a = this._$335(a, b, c, d, x[8], 7L, 1770035416L);
- d = this._$335(d, a, b, c, x[9], 12L, 2336552879L);
- c = this._$335(c, d, a, b, x[10], 17L, 4294925233L);
- b = this._$335(b, c, d, a, x[11], 22L, 2304563134L);
- a = this._$335(a, b, c, d, x[12], 7L, 1804603682L);
- d = this._$335(d, a, b, c, x[13], 12L, 4254626195L);
- c = this._$335(c, d, a, b, x[14], 17L, 2792965006L);
- b = this._$335(b, c, d, a, x[15], 22L, 1236535329L);
- a = this._$342(a, b, c, d, x[1], 5L, 4129170786L);
- d = this._$342(d, a, b, c, x[6], 9L, 3225465664L);
- c = this._$342(c, d, a, b, x[11], 14L, 643717713L);
- b = this._$342(b, c, d, a, x[0], 20L, 3921069994L);
- a = this._$342(a, b, c, d, x[5], 5L, 3593408605L);
- d = this._$342(d, a, b, c, x[10], 9L, 38016083L);
- c = this._$342(c, d, a, b, x[15], 14L, 3634488961L);
- b = this._$342(b, c, d, a, x[4], 20L, 3889429448L);
- a = this._$342(a, b, c, d, x[9], 5L, 568446438L);
- d = this._$342(d, a, b, c, x[14], 9L, 3275163606L);
- c = this._$342(c, d, a, b, x[3], 14L, 4107603335L);
- b = this._$342(b, c, d, a, x[8], 20L, 1163531501L);
- a = this._$342(a, b, c, d, x[13], 5L, 2850285829L);
- d = this._$342(d, a, b, c, x[2], 9L, 4243563512L);
- c = this._$342(c, d, a, b, x[7], 14L, 1735328473L);
- b = this._$342(b, c, d, a, x[12], 20L, 2368359562L);
- a = this._$343(a, b, c, d, x[5], 4L, 4294588738L);
- d = this._$343(d, a, b, c, x[8], 11L, 2272392833L);
- c = this._$343(c, d, a, b, x[11], 16L, 1839030562L);
- b = this._$343(b, c, d, a, x[14], 23L, 4259657740L);
- a = this._$343(a, b, c, d, x[1], 4L, 2763975236L);
- d = this._$343(d, a, b, c, x[4], 11L, 1272893353L);
- c = this._$343(c, d, a, b, x[7], 16L, 4139469664L);
- b = this._$343(b, c, d, a, x[10], 23L, 3200236656L);
- a = this._$343(a, b, c, d, x[13], 4L, 681279174L);
- d = this._$343(d, a, b, c, x[0], 11L, 3936430074L);
- c = this._$343(c, d, a, b, x[3], 16L, 3572445317L);
- b = this._$343(b, c, d, a, x[6], 23L, 76029189L);
- a = this._$343(a, b, c, d, x[9], 4L, 3654602809L);
- d = this._$343(d, a, b, c, x[12], 11L, 3873151461L);
- c = this._$343(c, d, a, b, x[15], 16L, 530742520L);
- b = this._$343(b, c, d, a, x[2], 23L, 3299628645L);
- a = this._$344(a, b, c, d, x[0], 6L, 4096336452L);
- d = this._$344(d, a, b, c, x[7], 10L, 1126891415L);
- c = this._$344(c, d, a, b, x[14], 15L, 2878612391L);
- b = this._$344(b, c, d, a, x[5], 21L, 4237533241L);
- a = this._$344(a, b, c, d, x[12], 6L, 1700485571L);
- d = this._$344(d, a, b, c, x[3], 10L, 2399980690L);
- c = this._$344(c, d, a, b, x[10], 15L, 4293915773L);
- b = this._$344(b, c, d, a, x[1], 21L, 2240044497L);
- a = this._$344(a, b, c, d, x[8], 6L, 1873313359L);
- d = this._$344(d, a, b, c, x[15], 10L, 4264355552L);
- c = this._$344(c, d, a, b, x[6], 15L, 2734768916L);
- b = this._$344(b, c, d, a, x[13], 21L, 1309151649L);
- a = this._$344(a, b, c, d, x[4], 6L, 4149444226L);
- d = this._$344(d, a, b, c, x[11], 10L, 3174756917L);
- c = this._$344(c, d, a, b, x[2], 15L, 718787259L);
- b = this._$344(b, c, d, a, x[9], 21L, 3951481745L);
- this._$315[0] += a;
- this._$315[1] += b;
- this._$315[2] += c;
- this._$315[3] += d;
- }
- private void _$353(byte[] output, long[] input, int len) {
- int i = 0;
- for (int j = 0; j < len; j += 4) {
- output[j] = (byte) ((int) (input[i] & 255L));
- output[j + 1] = (byte) ((int) (input[i] >>> 8 & 255L));
- output[j + 2] = (byte) ((int) (input[i] >>> 16 & 255L));
- output[j + 3] = (byte) ((int) (input[i] >>> 24 & 255L));
- ++i;
- }
- }
- private void _$359(long[] output, byte[] input, int len) {
- int i = 0;
- for (int j = 0; j < len; j += 4) {
- output[i] = _$361(input[j]) | _$361(input[j + 1]) << 8
- | _$361(input[j + 2]) << 16 | _$361(input[j + 3]) << 24;
- ++i;
- }
- }
- private static long _$361(byte b) {
- return b < 0 ? (long) (b & 255) : (long) b;
- }
- private static String _$327(byte ib) {
- char[] Digit = new char[] { '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
- char[] ob = new char[] { Digit[ib >>> 4 & 15], Digit[ib & 15] };
- String s = new String(ob);
- return s;
- }
- private String _$365(byte[] Value) {
- this._$322();
- this._$323(Value, Value.length);
- this._$325();
- this._$318 = "";
- for (int i = 0; i < 16; ++i) {
- this._$318 = this._$318 + _$327(this._$319[i]);
- }
- return this._$318;
- }
- public iMsgServer2000() {
- this._$290 = "";
- this._$291 = "";
- this._$292 = "DBSTEP V3.0";
- try {
- this._$289 = File.createTempFile("~GG", ".tmp");
- this._$294 = this._$289.getName();
- } catch (Exception arg1) {
- this._$291 = this._$291 + arg1.toString();
- System.out.println(arg1.toString());
- }
- this._$289.deleteOnExit();
- }
- protected void finalize() {
- try {
- if (this._$294.matches(this._$289.getName())) {
- this._$289.delete();
- }
- } catch (Exception arg1) {
- this._$291 = this._$291 + arg1.toString();
- System.out.println(arg1.toString());
- }
- }
- protected String FormatHead(String vString) {
- if (vString.length() > 16) {
- return vString.substring(0, 16);
- } else {
- for (int i = vString.length() + 1; i < 17; ++i) {
- vString = vString.concat(" ");
- }
- return vString;
- }
- }
- private byte[] _$378(byte[] mStream) {
- byte HeadSize = 64;
- boolean BodySize = false;
- boolean ErrorSize = false;
- boolean FileSize = false;
- byte Position = 0;
- int BlockSize = 1024 * this.BuffSize;
- byte[] BlockBuf = new byte[BlockSize];
- ByteArrayOutputStream mWite = new ByteArrayOutputStream();
- boolean CurSize = false;
- boolean CurRead = false;
- try {
- int BodySize1 = this._$290.getBytes(this.Charset).length;
- int ErrorSize1 = this._$291.getBytes(this.Charset).length;
- int FileSize1 = (int) this._$289.length();
- this._$293 = FileSize1;
- if (FileSize1 > 0 && !this.CryptFile) {
- FileInputStream e = new FileInputStream(this._$289);
- for (int CurSize1 = BlockSize; FileSize1 > 0; FileSize1 -= CurSize1) {
- if (FileSize1 - BlockSize < BlockSize) {
- CurSize1 = FileSize1;
- BlockBuf = new byte[FileSize1];
- }
- for (int CurRead1 = 0; CurRead1 < CurSize1; CurRead1 += e
- .read(BlockBuf, CurRead1, CurSize1 - CurRead1)) {
- ;
- }
- mWite.write(BlockBuf, 0, CurSize1);
- }
- this._$293 = mWite.size();
- e.close();
- mWite.close();
- }
- ByteArrayOutputStream e1 = new ByteArrayOutputStream();
- String HeadString = this.FormatHead(this._$292)
- + this.FormatHead(String.valueOf(BodySize1))
- + this.FormatHead(String.valueOf(ErrorSize1))
- + this.FormatHead(String.valueOf(this._$293));
- e1.write(HeadString.getBytes(), 0, HeadSize);
- int Position1 = Position + HeadSize;
- if (BodySize1 > 0) {
- e1.write(this._$290.getBytes());
- }
- Position1 += BodySize1;
- if (ErrorSize1 > 0) {
- e1.write(this._$291.getBytes(this.Charset));
- }
- int arg9999 = Position1 + ErrorSize1;
- if (this._$293 > 0) {
- e1.write(mWite.toByteArray());
- }
- e1.close();
- mStream = e1.toByteArray();
- return mStream;
- } catch (Exception arg13) {
- this._$291 = this._$291 + arg13.toString();
- System.out.println(arg13.toString());
- return null;
- }
- }
- private boolean _$378(HttpServletResponse response) {
- byte HeadSize = 64;
- boolean BodySize = false;
- boolean ErrorSize = false;
- boolean FileSize = false;
- byte Position = 0;
- int BlockSize = 1024 * this.BuffSize;
- byte[] BlockBuf = new byte[BlockSize];
- ByteArrayOutputStream mWite = new ByteArrayOutputStream();
- boolean CurSize = false;
- boolean CurRead = false;
- try {
- ServletOutputStream e = response.getOutputStream();
- int BodySize1 = this._$290.getBytes(this.Charset).length;
- int ErrorSize1 = this._$291.getBytes(this.Charset).length;
- int FileSize1 = (int) this._$289.length();
- this._$293 = FileSize1;
- if (FileSize1 > 0 && !this.CryptFile) {
- FileInputStream mRead = new FileInputStream(this._$289);
- for (int CurSize1 = BlockSize; FileSize1 > 0; FileSize1 -= CurSize1) {
- if (FileSize1 - BlockSize < BlockSize) {
- CurSize1 = FileSize1;
- BlockBuf = new byte[FileSize1];
- }
- for (int CurRead1 = 0; CurRead1 < CurSize1; CurRead1 += mRead
- .read(BlockBuf, CurRead1, CurSize1 - CurRead1)) {
- ;
- }
- mWite.write(BlockBuf, 0, CurSize1);
- }
- this._$293 = mWite.size();
- mRead.close();
- mWite.close();
- }
- String HeadString = this.FormatHead(this._$292)
- + this.FormatHead(String.valueOf(BodySize1))
- + this.FormatHead(String.valueOf(ErrorSize1))
- + this.FormatHead(String.valueOf(this._$293));
- e.write(HeadString.getBytes());
- int Position1 = Position + HeadSize;
- if (BodySize1 > 0) {
- e.write(this._$290.getBytes());
- }
- Position1 += BodySize1;
- if (ErrorSize1 > 0) {
- e.write(this._$291.getBytes(this.Charset));
- }
- int arg9999 = Position1 + ErrorSize1;
- if (this._$293 > 0) {
- e.write(mWite.toByteArray());
- }
- e.flush();
- return true;
- } catch (Exception arg14) {
- this._$291 = this._$291 + arg14.toString();
- System.out.println(arg14.toString());
- return false;
- }
- }
- public byte[] MsgVariant() {
- Object mStream = null;
- return this._$378((byte[]) mStream);
- }
- private static int _$402(byte[] b) {
- int s = 0;
- for (int i = 3; i > 0; --i) {
- if (b[i] >= 0) {
- s += b[i];
- } else {
- s = s + 256 + b[i];
- }
- s *= 256;
- }
- if (b[0] >= 0) {
- s += b[0];
- } else {
- s = s + 256 + b[0];
- }
- return s;
- }
- public byte[] ToDocument(byte[] Value) {
- byte[] mIntBuf = new byte[] { 0, 0, 0, 0 };
- byte[] mFlagBuf = new byte[] { 68, 73, 82, 71 };
- Object mOutBuf = null;
- boolean HeadFlag = false;
- boolean Signature = false;
- boolean WordSize = false;
- boolean PageSize = false;
- boolean FlagSize = false;
- try {
- int HeadFlag1 = _$402(mFlagBuf);
- ByteArrayInputStream e = new ByteArrayInputStream(Value);
- e.read(mIntBuf, 0, 4);
- int Signature1 = _$402(mIntBuf);
- e.read(mIntBuf, 0, 4);
- int WordSize1 = _$402(mIntBuf);
- e.read(mIntBuf, 0, 4);
- int PageSize1 = _$402(mIntBuf);
- e.read(mIntBuf, 0, 4);
- int FlagSize1 = _$402(mIntBuf);
- if (Signature1 != HeadFlag1) {
- e.reset();
- WordSize1 = e.available();
- }
- byte[] mOutBuf1 = new byte[WordSize1];
- e.read(mOutBuf1, 0, WordSize1);
- return mOutBuf1;
- } catch (Exception arg10) {
- this._$291 = this._$291 + arg10.toString();
- System.out.println(arg10.toString());
- return (byte[]) mOutBuf;
- }
- }
- private boolean _$413(byte[] mStream) {
- byte HeadSize = 64;
- boolean BodySize = false;
- boolean ErrorSize = false;
- boolean FileSize = false;
- boolean Position = false;
- boolean CurRead = false;
- String Md5Value = "";
- String Md5Calcu = "";
- try {
- byte Position1 = 0;
- String HeadString = new String(mStream, Position1, HeadSize);
- this._$292 = HeadString.substring(0, 15);
- int BodySize1 = Integer.parseInt(HeadString.substring(16, 31)
- .trim());
- int ErrorSize1 = Integer.parseInt(HeadString.substring(32, 47)
- .trim());
- int FileSize1 = Integer.parseInt(HeadString.substring(48, 63)
- .trim());
- this._$293 = FileSize1;
- int Position2 = Position1 + HeadSize;
- if (BodySize1 > 0) {
- this._$290 = new String(mStream, Position2, BodySize1);
- }
- Position2 += BodySize1;
- if (ErrorSize1 > 0) {
- this._$291 = new String(mStream, Position2, ErrorSize1);
- }
- Position2 += ErrorSize1;
- if (FileSize1 > 0) {
- if (!this.CryptFile) {
- ByteArrayInputStream e = new ByteArrayInputStream(mStream,
- Position2, FileSize1);
- FileOutputStream mWite = new FileOutputStream(this._$289);
- int BlockSize = 1024 * this.BuffSize;
- boolean CurSize = false;
- byte[] BlockBuf = new byte[BlockSize];
- int CurSize1 = BlockSize;
- while (true) {
- if (FileSize1 <= 0) {
- mWite.close();
- e.close();
- break;
- }
- if (FileSize1 < BlockSize) {
- CurSize1 = FileSize1;
- BlockBuf = new byte[FileSize1];
- }
- for (int CurRead1 = 0; CurRead1 < CurSize1; CurRead1 += e
- .read(BlockBuf, CurRead1, CurSize1 - CurRead1)) {
- ;
- }
- mWite.write(BlockBuf, 0, CurSize1);
- FileSize1 -= CurSize1;
- }
- }
- this._$293 = (int) this._$289.length();
- }
- return true;
- } catch (Exception arg15) {
- this._$291 = this._$291 + arg15.toString();
- System.out.println(arg15.toString());
- return false;
- }
- }
- private boolean _$413(HttpServletRequest request) {
- byte HeadSize = 64;
- boolean BodySize = false;
- boolean ErrorSize = false;
- boolean FileSize = false;
- boolean CurRead = false;
- try {
- ServletInputStream e = request.getInputStream();
- byte[] BlockBuf = new byte[HeadSize];
- e.read(BlockBuf, 0, HeadSize);
- String HeadString = new String(BlockBuf, 0, HeadSize);
- this._$292 = HeadString.substring(0, 15);
- int BodySize1 = Integer.parseInt(HeadString.substring(16, 31)
- .trim());
- int ErrorSize1 = Integer.parseInt(HeadString.substring(32, 47)
- .trim());
- this._$293 = Integer.parseInt(HeadString.substring(48, 63).trim());
- int FileSize1 = this._$293;
- int CurRead1;
- if (BodySize1 > 0) {
- BlockBuf = new byte[BodySize1];
- for (CurRead1 = 0; CurRead1 < BodySize1; CurRead1 += e.read(
- BlockBuf, CurRead1, BodySize1 - CurRead1)) {
- ;
- }
- this._$290 = new String(BlockBuf, 0, BodySize1);
- }
- if (ErrorSize1 > 0) {
- BlockBuf = new byte[ErrorSize1];
- e.read(BlockBuf, 0, ErrorSize1);
- this._$291 = new String(BlockBuf, 0, ErrorSize1);
- }
- if (FileSize1 > 0) {
- if (!this.CryptFile) {
- int BlockSize = 1024 * this.BuffSize;
- boolean CurSize = false;
- FileOutputStream mWite = new FileOutputStream(this._$289);
- BlockBuf = new byte[BlockSize];
- int CurSize1 = BlockSize;
- while (true) {
- if (FileSize1 <= 0) {
- mWite.close();
- e.close();
- break;
- }
- if (FileSize1 < BlockSize) {
- CurSize1 = FileSize1;
- BlockBuf = new byte[FileSize1];
- }
- for (CurRead1 = 0; CurRead1 < CurSize1; CurRead1 += e
- .read(BlockBuf, CurRead1, CurSize1 - CurRead1)) {
- ;
- }
- mWite.write(BlockBuf, 0, CurSize1);
- FileSize1 -= CurSize1;
- }
- }
- this._$293 = (int) this._$289.length();
- }
- return true;
- } catch (Exception arg12) {
- this._$291 = this._$291 + arg12.toString();
- System.out.println(arg12.toString());
- return false;
- }
- }
- public void MsgVariant(byte[] mStream) {
- this._$413(mStream);
- }
- public boolean SavePackage(String FileName, ServletRequest request) {
- byte[] BlockBuf = new byte[1024 * this.BuffSize];
- try {
- int e = request.getContentLength();
- boolean mIndex = false;
- ServletInputStream mRead = request.getInputStream();
- FileOutputStream mFile;
- int mIndex1;
- for (mFile = new FileOutputStream(FileName); e > 0; e -= mIndex1) {
- mIndex1 = mRead.read(BlockBuf);
- mFile.write(BlockBuf, 0, mIndex1);
- }
- mFile.close();
- return true;
- } catch (Exception arg7) {
- arg7.printStackTrace();
- return false;
- }
- }
- public boolean MsgFileSave(String FileName) {
- long FileSize = 0L;
- int BlockSize = 1024 * this.BuffSize;
- FileSize = this._$289.length();
- try {
- FileOutputStream e = new FileOutputStream(FileName);
- FileInputStream mThis = new FileInputStream(this._$289);
- int CurSize;
- for (byte[] BlockBuf = new byte[BlockSize]; FileSize > 0L; FileSize -= (long) CurSize) {
- CurSize = mThis.read(BlockBuf, 0, BlockSize);
- e.write(BlockBuf, 0, CurSize);
- }
- mThis.close();
- e.close();
- return true;
- } catch (Exception arg8) {
- this._$291 = this._$291 + arg8.toString();
- System.out.println(arg8.toString());
- return false;
- }
- }
- public boolean MsgFileLoad(String FileName) {
- try {
- if (this._$294.matches(this._$289.getName())) {
- this._$289.delete();
- }
- this._$289 = new File(FileName);
- this._$293 = (int) this._$289.length();
- return true;
- } catch (Exception arg2) {
- this._$291 = this._$291 + arg2.toString();
- System.out.println(arg2.toString());
- return false;
- }
- }
- public int FileSizeByName(String FileName) {
- try {
- File e = new File(FileName);
- return (int) e.length();
- } catch (Exception arg2) {
- this._$291 = this._$291 + arg2.toString();
- System.out.println(arg2.toString());
- return 0;
- }
- }
- public String MsgTextBody() {
- return this._$290;
- }
- public byte[] MsgFileBody() {
- byte[] mBuffer = new byte[this._$293];
- try {
- FileInputStream e = new FileInputStream(this._$289);
- e.read(mBuffer, 0, this._$293);
- e.close();
- } catch (Exception arg2) {
- this._$291 = this._$291 + arg2.toString();
- System.out.println(arg2.toString());
- }
- return mBuffer;
- }
- public String MsgError() {
- return this._$291;
- }
- public String MsgVersion() {
- return this._$292;
- }
- public void MsgTextBody(String Value) {
- this._$290 = Value;
- }
- public void MsgFileBody(byte[] Value) {
- this.MsgFileClear();
- try {
- FileOutputStream mFile = new FileOutputStream(this._$289);
- mFile.write(Value);
- mFile.close();
- } catch (Exception arg3) {
- this._$291 = this._$291 + arg3.toString();
- System.out.println(this._$291);
- }
- this._$293 = Value.length;
- }
- public void MsgError(String Value) {
- this._$291 = Value;
- }
- public int MsgFileSize() {
- return this._$293;
- }
- public void MsgFileSize(int value) {
- this._$293 = value;
- }
- public void MsgFileClear() {
- this._$293 = 0;
- if (this._$294.matches(this._$289.getName())) {
- this._$289.delete();
- }
- try {
- this._$289 = File.createTempFile("~GG", ".tmp");
- this._$294 = this._$289.getName();
- } catch (Exception arg1) {
- this._$291 = this._$291 + arg1.toString();
- System.out.println(arg1.toString());
- }
- }
- public void MsgTextClear() {
- this._$290 = "";
- }
- public void MsgErrorClear() {
- this._$291 = "";
- }
- public String DecodeBase64(String Value) {
- ByteArrayOutputStream o = new ByteArrayOutputStream();
- String m = "";
- byte[] d = new byte[4];
- try {
- int count = 0;
- byte[] x = Value.getBytes();
- while (count < x.length) {
- for (int n = 0; n <= 3; ++n) {
- if (count >= x.length) {
- d[n] = 64;
- } else {
- int y = this._$288.indexOf(x[count]);
- if (y < 0) {
- y = 65;
- }
- d[n] = (byte) y;
- }
- ++count;
- }
- o.write((byte) (((d[0] & 63) << 2) + ((d[1] & 48) >> 4)));
- if (d[2] != 64) {
- o.write((byte) (((d[1] & 15) << 4) + ((d[2] & 60) >> 2)));
- if (d[3] != 64) {
- o.write((byte) (((d[2] & 3) << 6) + (d[3] & 63)));
- }
- }
- }
- } catch (StringIndexOutOfBoundsException arg10) {
- this._$291 = this._$291 + arg10.toString();
- System.out.println(arg10.toString());
- }
- try {
- m = o.toString(this.Charset);
- } catch (UnsupportedEncodingException arg9) {
- System.out.println(arg9.toString());
- }
- return m;
- }
- public String EncodeBase64(String Value) {
- ByteArrayOutputStream o = new ByteArrayOutputStream();
- byte[] d = new byte[4];
- try {
- int count = 0;
- byte[] x = Value.getBytes(this.Charset);
- while (count < x.length) {
- byte c = x[count];
- ++count;
- d[0] = (byte) ((c & 252) >> 2);
- d[1] = (byte) ((c & 3) << 4);
- if (count < x.length) {
- c = x[count];
- ++count;
- d[1] += (byte) ((c & 240) >> 4);
- d[2] = (byte) ((c & 15) << 2);
- if (count < x.length) {
- c = x[count];
- ++count;
- d[2] = (byte) (d[2] + ((c & 192) >> 6));
- d[3] = (byte) (c & 63);
- } else {
- d[3] = 64;
- }
- } else {
- d[2] = 64;
- d[3] = 64;
- }
- for (int n = 0; n <= 3; ++n) {
- o.write(this._$288.charAt(d[n]));
- }
- }
- } catch (StringIndexOutOfBoundsException arg8) {
- this._$291 = this._$291 + arg8.toString();
- System.out.println(arg8.toString());
- } catch (UnsupportedEncodingException arg9) {
- System.out.println(arg9.toString());
- }
- return o.toString();
- }
- public int GetFieldCount() {
- byte i = 0;
- int j = 0;
- for (int arg2 = this._$290.indexOf("\r\n", i + 1); arg2 != -1; arg2 = this._$290
- .indexOf("\r\n", arg2 + 1)) {
- ++j;
- }
- return j;
- }
- public String GetFieldName(int Index) {
- int i = 0;
- int j = 0;
- boolean k = false;
- boolean n = false;
- String mFieldString = "";
- String mFieldName = "";
- String mReturn = "";
- while (i != -1 && j < Index) {
- i = this._$290.indexOf("\r\n", i + 1);
- if (i != -1) {
- ++j;
- }
- }
- int arg8 = this._$290.indexOf("\r\n", i + 1);
- if (i != -1 && arg8 != -1) {
- if (i == 0) {
- mFieldString = this._$290.substring(i, arg8);
- } else {
- mFieldString = this._$290.substring(i + 2, arg8);
- }
- int arg9 = mFieldString.indexOf("=", 0);
- if (arg9 != -1) {
- mFieldName = mFieldString.substring(0, arg9);
- mReturn = mFieldName;
- }
- }
- return mReturn;
- }
- public String GetFieldValue(int Index) {
- int i = 0;
- int j = 0;
- boolean k = false;
- boolean n = false;
- String mFieldString = "";
- String mFieldValue = "";
- String mReturn = "";
- while (i != -1 && j < Index) {
- i = this._$290.indexOf("\r\n", i + 1);
- if (i != -1) {
- ++j;
- }
- }
- int arg8 = this._$290.indexOf("\r\n", i + 1);
- if (i != -1 && arg8 != -1) {
- if (i == 0) {
- mFieldString = this._$290.substring(i, arg8);
- } else {
- mFieldString = this._$290.substring(i + 2, arg8);
- }
- int arg9 = mFieldString.indexOf("=", 0);
- if (arg9 != -1) {
- mFieldValue = mFieldString.substring(arg9 + 1,
- mFieldString.length());
- mReturn = this.DecodeBase64(mFieldValue);
- }
- }
- return mReturn;
- }
- public String GetFieldText() {
- return this._$290.toString();
- }
- public String GetMsgByName(String FieldName) {
- boolean i = false;
- boolean j = false;
- String mReturn = "";
- String mFieldName = FieldName.trim().concat("=");
- int i1 = this._$290.indexOf(mFieldName);
- if (i1 != -1) {
- int j1 = this._$290.indexOf("\r\n", i1 + 1);
- i1 += mFieldName.length();
- if (j1 != -1) {
- String mFieldValue = this._$290.substring(i1, j1);
- mReturn = this.DecodeBase64(mFieldValue);
- return mReturn;
- } else {
- return mReturn;
- }
- } else {
- return mReturn;
- }
- }
- public void SetMsgByName(String FieldName, String FieldValue) {
- String mFieldText = "";
- String mFieldHead = "";
- String mFieldNill = "";
- boolean i = false;
- boolean j = false;
- boolean f = false;
- String mFieldName = FieldName.trim().concat("=");
- String mFieldValue = this.EncodeBase64(FieldValue);
- mFieldText = mFieldName + mFieldValue + "\r\n";
- int i1 = this._$290.indexOf(mFieldName);
- if (i1 != -1) {
- int j1 = this._$290.indexOf("\r\n", i1 + 1);
- if (j1 != -1) {
- mFieldHead = this._$290.substring(0, i1);
- mFieldNill = this._$290.substring(j1 + 2);
- f = true;
- }
- }
- if (f) {
- this._$290 = mFieldHead + mFieldText + mFieldNill;
- } else {
- this._$290 = this._$290.concat(mFieldText);
- }
- }
- public boolean MakeDirectory(String FilePath) {
- File mFile = new File(FilePath);
- mFile.mkdirs();
- return mFile.isDirectory();
- }
- public boolean MKDirectory(String FilePath) {
- File mFile = new File(FilePath);
- mFile.mkdirs();
- return mFile.isDirectory();
- }
- public boolean RMDirectory(String FilePath) {
- File mFile = new File(FilePath);
- if (mFile.isDirectory()) {
- mFile.delete();
- }
- return true;
- }
- public boolean DelFile(String FileName) {
- File mFile = new File(FileName);
- if (mFile.exists()) {
- mFile.delete();
- }
- return true;
- }
- public boolean DelTree(String FilePath) {
- File mFile = new File(FilePath);
- if (mFile.isDirectory()) {
- mFile.delete();
- }
- return true;
- }
- public int LoadFilePoint(String FileName) {
- boolean i = false;
- boolean j = false;
- boolean mSize = false;
- String mText = "";
- String mReturn = "-1";
- String mFieldName = "INDEX=";
- try {
- File e = new File(FileName + ".fp");
- int mSize1 = (int) e.length();
- byte[] mBuffer = new byte[mSize1];
- FileInputStream mStream = new FileInputStream(e);
- mStream.read(mBuffer, 0, mSize1);
- mStream.close();
- mText = new String(mBuffer);
- } catch (Exception arg10) {
- this._$291 = this._$291 + arg10.toString();
- return Integer.parseInt(mReturn);
- }
- int i1 = mText.indexOf(mFieldName);
- if (i1 != -1) {
- int j1 = mText.indexOf("\r\n", i1 + 1);
- i1 += mFieldName.length();
- if (j1 != -1) {
- mReturn = mText.substring(i1, j1 - i1);
- return Integer.parseInt(mReturn);
- } else {
- return Integer.parseInt(mReturn);
- }
- } else {
- return Integer.parseInt(mReturn);
- }
- }
- public boolean SaveFilePoint(String FileName, int FCount) {
- boolean i = false;
- boolean j = false;
- boolean mSize = false;
- String mFieldName = "INDEX=";
- String mCount = "";
- try {
- FileOutputStream e = new FileOutputStream(FileName);
- mCount = mFieldName + FCount + "\r\n";
- byte[] mBuffer = mCount.getBytes();
- int mSize1 = mBuffer.length;
- e.write(mBuffer, 0, mSize1);
- e.close();
- return true;
- } catch (Exception arg9) {
- this._$291 = this._$291 + arg9.toString();
- System.out.println("SaveFilePoint:" + this._$291);
- return false;
- }
- }
- public boolean LoadStreamFromFile(String FileName, int Index) {
- boolean mPosition = false;
- boolean mSize = false;
- boolean mLength = false;
- try {
- File mLocal = new File(FileName);
- int mSize1 = (int) mLocal.length();
- FileInputStream mFile = new FileInputStream(mLocal);
- FileOutputStream e = new FileOutputStream(this._$289);
- int mPosition1 = Index * this.BuffSize * 1024;
- int mLength1;
- if (mPosition1 + this.BuffSize * 1024 < mSize1) {
- mLength1 = this.BuffSize * 1024;
- } else {
- mLength1 = mSize1 - mPosition1;
- }
- mFile.skip((long) mPosition1);
- byte[] mBuffer = new byte[mLength1];
- mFile.read(mBuffer);
- mFile.close();
- e.write(mBuffer);
- e.close();
- return true;
- } catch (Exception arg9) {
- this._$291 = this._$291 + arg9.toString();
- System.out.println("LoadStreamFromFile:" + this._$291);
- return false;
- }
- }
- public boolean SaveStreamToFile(String FileName, int Index) {
- if (Index == 0) {
- this.DelFile(FileName);
- }
- try {
- RandomAccessFile mFile = new RandomAccessFile(FileName, "rw");
- FileInputStream e = new FileInputStream(this._$289);
- byte[] mBuffer = new byte[this._$293];
- e.read(mBuffer);
- e.close();
- mFile.seek(mFile.length());
- mFile.write(mBuffer);
- mFile.close();
- return true;
- } catch (Exception arg5) {
- this._$291 = this._$291 + arg5.toString();
- System.out.println("SaveStreamToFile:" + this._$291);
- return false;
- }
- }
- public boolean SaveFromStream(String FileName, int Index) {
- if (Index == 0) {
- this.DelFile(FileName);
- }
- try {
- RandomAccessFile mFile = new RandomAccessFile(FileName, "rw");
- FileInputStream e = new FileInputStream(this._$289);
- byte[] mBuffer = new byte[this._$293];
- e.read(mBuffer);
- e.close();
- mFile.seek(mFile.length());
- mFile.write(mBuffer);
- mFile.close();
- return true;
- } catch (Exception arg5) {
- this._$291 = this._$291 + arg5.toString();
- System.out.println("SaveFromStream:" + this._$291);
- return false;
- }
- }
- public boolean DecodeBase64ToFile(String Value, String FileName) {
- ByteArrayOutputStream o = new ByteArrayOutputStream();
- boolean mResult = false;
- byte[] d = new byte[4];
- try {
- int count = 0;
- byte[] x = Value.getBytes();
- while (count < x.length) {
- for (int n = 0; n <= 3; ++n) {
- if (count >= x.length) {
- d[n] = 64;
- } else {
- int y = this._$288.indexOf(x[count]);
- if (y < 0) {
- y = 65;
- }
- d[n] = (byte) y;
- }
- ++count;
- }
- o.write((byte) (((d[0] & 63) << 2) + ((d[1] & 48) >> 4)));
- if (d[2] != 64) {
- o.write((byte) (((d[1] & 15) << 4) + ((d[2] & 60) >> 2)));
- if (d[3] != 64) {
- o.write((byte) (((d[2] & 3) << 6) + (d[3] & 63)));
- }
- }
- }
- FileOutputStream e = new FileOutputStream(FileName);
- byte[] mBuffer = o.toByteArray();
- int mSize = mBuffer.length;
- e.write(mBuffer, 0, mSize);
- e.close();
- mResult = true;
- } catch (Exception arg12) {
- this._$291 = this._$291 + arg12.toString();
- mResult = false;
- System.out.println(arg12.toString());
- }
- return mResult;
- }
- public boolean SaveFromFile(String FileName, int FileCount) {
- boolean mIndex = false;
- String mPkName = "";
- mPkName = FileName + ".fp";
- this.DelFile(mPkName);
- try {
- FileOutputStream mFile = new FileOutputStream(FileName);
- for (int arg10 = 0; arg10 <= FileCount; ++arg10) {
- mPkName = FileName + "." + arg10;
- File nTemp = new File(mPkName);
- FileInputStream mTemp = new FileInputStream(nTemp);
- byte[] mBuffer = new byte[(int) nTemp.length()];
- mTemp.read(mBuffer, 0, (int) nTemp.length());
- mFile.write(mBuffer, 0, (int) nTemp.length());
- mTemp.close();
- nTemp.delete();
- }
- mFile.close();
- return true;
- } catch (Exception arg9) {
- this._$291 = this._$291 + arg9.toString();
- System.out.println("SaveFromFile:" + this._$291);
- return false;
- }
- }
- public void Load(HttpServletRequest request) {
- this.Charset = request.getHeader("charset");
- if (this.Charset == null) {
- this.Charset = "GB2312";
- }
- if (!this._$413(request)) {
- System.out.println("StreamToMsg Error");
- }
- }
- public void Send(HttpServletResponse response) {
- if (!this._$378(response)) {
- System.out.println("MsgToStream Error");
- }
- try {
- if (this._$294.matches(this._$289.getName())) {
- this._$289.delete();
- }
- } catch (Exception arg2) {
- this._$291 = this._$291 + arg2.toString();
- System.out.println(arg2.toString());
- }
- }
- public byte[] ReadPackage(HttpServletRequest request) {
- byte[] mStream = null;
- int totalRead = 0;
- boolean readBytes = false;
- boolean totalBytes = false;
- this.Charset = request.getHeader("charset");
- if (this.Charset == null) {
- this.Charset = "GB2312";
- }
- try {
- int totalBytes1 = request.getContentLength();
- int readBytes1;
- for (mStream = new byte[totalBytes1]; totalRead < totalBytes1; totalRead += readBytes1) {
- readBytes1 = request.getInputStream().read(mStream, totalRead,
- totalBytes1 - totalRead);
- }
- this.MsgVariant(mStream);
- } catch (Exception arg6) {
- System.out.println("ReadPackage:" + arg6.toString());
- }
- return mStream;
- }
- public void SendPackage(HttpServletResponse response) {
- try {
- ServletOutputStream e = response.getOutputStream();
- e.write(this.MsgVariant());
- e.flush();
- e.close();
- } catch (Exception arg2) {
- System.out.println("SendPackage:" + arg2.toString());
- }
- }
- public static String Version() {
- return "8,1,0,12";
- }
- public static String Version(String SoftwareName) {
- String mVersion = "0,0,0,0";
- if (SoftwareName.equalsIgnoreCase("HandWrite")
- || SoftwareName.equalsIgnoreCase("")) {
- mVersion = "4,0,0,8";
- }
- if (SoftwareName.equalsIgnoreCase("iWebSignature")) {
- mVersion = "5,8,0,0";
- }
- return mVersion;
- }
- public static String VersionEx() {
- return "高级版本";
- }
- public static String VersionEx(String SoftwareName) {
- String mVersionEx = "错误版本";
- if (SoftwareName.equalsIgnoreCase("HandWrite")
- || SoftwareName.equalsIgnoreCase("")) {
- mVersionEx = "高级版本";
- }
- if (SoftwareName.equalsIgnoreCase("iWebSignature")) {
- mVersionEx = "标准版本";
- }
- return mVersionEx;
- }
- public static String CopyRight(String SoftwareName) {
- String mVersionEx = "错误版本";
- if (SoftwareName.equalsIgnoreCase("HandWrite")
- || SoftwareName.equalsIgnoreCase("")) {
- mVersionEx = "高级版本 江西金格科技股份有限公司,所权所有";
- }
- if (SoftwareName.equalsIgnoreCase("iWebSignature")) {
- mVersionEx = "标准版本 江西金格科技股份有限公司,所权所有";
- }
- return mVersionEx;
- }
- public static String VersionDesc() {
- String mVersionDesc = "www.kinggrid.com KingGrid-iMsgServer2000";
- return mVersionDesc;
- }
- public static String ProdDesc() {
- String mProdDescX = " 金格科技自主创新开发的实时安全传输技术——DBPacketTM通讯协议包,采用前端和后端方式设计,实现客户端与服务器端的数据安全可靠传递、交互。金格科技是专注于“可信应用软件”研究与开发的自主创新型高新技术企业,凭借完全自主创新的核心技术和强大的研发力量,为社会提供安全可靠的可信应用软件产品、技术和服务,日益成长为中国可信应用产业的积极推动者和可信应用软件领域的领军企业。";
- String mProdDesc = "Kinggrid:iWebOffice2000/iWebOffice2003/iWebOffice2003/iWebOffice2009/iWebOffice2012/";
- mProdDesc = mProdDesc
- + "iWebRevision/iWebPDF/iWebPicture/iWebFile2005/iWebBarcode/";
- mProdDesc = mProdDesc + "iSignature/iSolutions";
- return mProdDesc;
- }
- }
|