⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jmtools.java

📁 使用短信猫发送短信的程序源代码
💻 JAVA
字号:
// Decompiled by DJ v3.9.9.91 Copyright 2005 Atanas Neshkov  Date: 2007-12-13 22:46:37
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   JMTools.java

import java.io.*;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Date;
import java.util.StringTokenizer;

public class JMTools
{

    public JMTools()
    {
    }

    public static boolean checkFileExists(String s)
    {
        File file = new File(s);
        return file.exists() && file.isFile();
    }

    public static String exec(String s)
    {
        byte abyte0[] = new byte[1024];
        String s2 = "";
        try
        {
            Process process = Runtime.getRuntime().exec(s);
            int j;
            if((j = process.waitFor()) != 0)
                return "error exit " + Integer.toString(j);
            InputStream inputstream = process.getInputStream();
            int i;
            while((i = inputstream.read(abyte0, 0, 1024)) != -1) 
            {
                String s1 = new String(abyte0, 0, i);
                s2 = s2 + s1;
            }
            if(!s2.startsWith("en\n") && !s2.startsWith("un\n") && !s2.startsWith("cn\n") && !s2.startsWith("null") && !s2.startsWith("error"))
                return "error head";
            else
                return s2 + "\n";
        }
        catch(Exception exception)
        {
            return "error exec";
        }
    }

    public static String replaceString(String s, String s1, String s2)
    {
        int i = 0;
        int j = 0;
        String s3 = "";
        while((j = s.indexOf(s1, i)) != -1) 
        {
            s3 = s3 + s.substring(i, j);
            s3 = s3 + s2;
            i = j + s1.length();
        }
        s3 = s3 + s.substring(i);
        return s3;
    }

    public static String getDatetimeString()
    {
        Date date = new Date();
        return F.f(date, "yyyy-MM-dd HH:mm:ss");
    }

    public static String encodeMP(String s)
    {
        String s1;
        if(s.length() % 2 == 0)
            s1 = s;
        else
            s1 = s + "F";
        String s2 = "";
        for(int i = 0; i < s.length(); i += 2)
        {
            s2 = s2 + s1.substring(i + 1, i + 2);
            s2 = s2 + s1.substring(i, i + 1);
        }

        return s2;
    }

    public static String decodeMP(String s)
    {
        String s1 = new String("");
        for(int i = 0; i < s.length() / 2; i++)
        {
            s1 = s1 + s.substring(i * 2 + 1, i * 2 + 2);
            s1 = s1 + s.substring(i * 2, i * 2 + 1);
        }

        if(s1.endsWith("F"))
            s1 = s1.substring(0, s1.length() - 1);
        return s1;
    }

    public static String msgEncodeE7(String s)
    {
        char ac[] = {
            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 
            'A', 'B', 'C', 'D', 'E', 'F'
        };
        byte abyte0[] = s.getBytes();
        int i = abyte0.length;
        int j = (i * 7) / 8;
        if((i * 7) % 8 > 0)
            j++;
        byte abyte1[] = new byte[j];
        int k = 0;
        for(int l = 0; l < i; l++)
        {
            for(int i1 = 0; i1 < 7; i1++)
            {
                if(k - i1 > 0)
                    abyte1[(l * 7 + i1) / 8] += (byte)((abyte0[l] & (byte)(int)Math.pow(2D, i1)) << k - i1);
                else
                    abyte1[(l * 7 + i1) / 8] += (byte)((abyte0[l] & (byte)(int)Math.pow(2D, i1)) >> -(k - i1));
                if(++k > 7)
                    k = 0;
            }

        }

        char ac1[] = new char[j * 2];
        for(int j1 = 0; j1 < j; j1++)
        {
            byte byte0 = (byte)(0xf & abyte1[j1] >> 4);
            ac1[j1 * 2] = ac[byte0];
            byte0 = (byte)(0xf & abyte1[j1]);
            ac1[j1 * 2 + 1] = ac[byte0];
        }

        String s1 = new String(ac1);
        return s1;
    }

    public static String msgDecodeE7(String s, int i)
    {
        byte abyte0[] = new byte[i];
        byte abyte1[] = new byte[s.length() / 2];
        for(int j = 0; j < abyte1.length; j++)
            abyte1[j] = Integer.decode("0x" + s.substring(j * 2, j * 2 + 2)).byteValue();

        for(int k = 0; k < i; k++)
        {
            for(int l = 0; l < 7; l++)
            {
                int i1 = (k * 7 + l) / 8;
                int j1 = (k * 7 + l) % 8;
                int k1 = j1 - l;
                if(k1 < 0)
                    abyte0[k] += (byte)((abyte1[i1] & 1 << j1) << -k1);
                else
                    abyte0[k] += (byte)((abyte1[i1] & 1 << j1) >> k1);
            }

        }

        String s1 = new String(abyte0);
        return s1;
    }

    public static String msgDecodeE8(String s)
    {
        byte abyte0[] = new byte[s.length() / 2];
        for(int i = 0; i < abyte0.length; i++)
            abyte0[i] += Integer.decode("0x" + s.substring(i * 2, i * 2 + 1) + s.substring(i * 2 + 1, i * 2 + 2)).byteValue();

        return new String(abyte0);
    }

    public static String msgEncodeGB(String s)
    {
        byte abyte0[] = null;
        try
        {
            String s1 = new String(s.getBytes(), "GB2312");
            abyte0 = s1.getBytes("UTF-16BE");
        }
        catch(Exception exception) { }
        String s2 = "";
        for(int i = 0; i < abyte0.length; i++)
        {
            String s3 = F.f(abyte0[i], (short)32).toUpperCase();
            if(s3.length() == 4)
                s2 = s2 + s3.substring(2);
            else
                s2 = s2 + "0" + s3.substring(2);
        }

        return s2;
    }

    public static String msgDecodeGB(String s)
    {
        byte abyte0[] = new byte[4096];
        String s2 = "";
        int j = 0;
        for(int i = 0; i < s.length() && j < abyte0.length; i += 2)
        {
            abyte0[j] = Integer.decode("0x" + s.substring(i, i + 2)).byteValue();
            j++;
        }

        try
        {
            String s1 = new String(abyte0, 0, j, "UTF-16BE");
            byte abyte1[] = s1.getBytes("GB2312");
            s2 = new String(abyte1);
        }
        catch(Exception exception) { }
        return s2;
    }

    public static String msgEncodeUTF8(String s)
    {
        byte abyte0[] = null;
        try
        {
            String s1 = new String(s.getBytes(), "UTF-8");
            abyte0 = s1.getBytes("UTF-16BE");
        }
        catch(Exception exception) { }
        String s2 = "";
        for(int i = 0; i < abyte0.length; i++)
        {
            String s3 = F.f(abyte0[i], (short)32).toUpperCase();
            if(s3.length() == 4)
                s2 = s2 + s3.substring(2);
            else
                s2 = s2 + "0" + s3.substring(2);
        }

        return s2;
    }

    public static String msgDecodeUTF8(String s)
    {
        byte abyte0[] = new byte[4096];
        String s2 = "";
        int j = 0;
        for(int i = 0; i < s.length() && j < abyte0.length; i += 2)
        {
            abyte0[j] = Integer.decode("0x" + s.substring(i, i + 2)).byteValue();
            j++;
        }

        try
        {
            String s1 = new String(abyte0, 0, j, "UTF-16BE");
            byte abyte1[] = s1.getBytes("UTF-8");
            s2 = new String(abyte1);
        }
        catch(Exception exception) { }
        return s2;
    }

    public static boolean isUTFMsg(String s)
    {
        if(s == null || s.length() == 0 || s.length() % 4 != 0)
            return false;
        StringTokenizer stringtokenizer = new StringTokenizer(s, "0123456789ABCDEF", false);
        return !stringtokenizer.hasMoreTokens();
    }

    public static String toHexString(int i)
    {
        String s = Integer.toHexString(i).toUpperCase();
        String s1;
        if(s.length() % 2 == 0)
            s1 = s;
        else
            s1 = "0" + s;
        return s1;
    }

    public static String MD5(String s)
    {
        try
        {
            StringBuffer stringbuffer = new StringBuffer("");
            MessageDigest messagedigest = MessageDigest.getInstance("MD5");
            messagedigest.update(s.getBytes());
            byte abyte0[] = messagedigest.digest();
            for(int i = 0; i != 16; i++)
            {
                Byte byte1 = new Byte(abyte0[i]);
                int j;
                if(byte1.intValue() < 0)
                    j = 256 + byte1.intValue();
                else
                    j = byte1.intValue();
                if(j < 16)
                    stringbuffer.append("0");
                stringbuffer.append(Integer.toHexString(j));
            }

            return stringbuffer.toString();
        }
        catch(NoSuchAlgorithmException nosuchalgorithmexception)
        {
            return null;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -