diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..e96534f
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/xxx/winio/AppGUI.java b/src/main/java/com/xxx/winio/AppGUI.java
new file mode 100644
index 0000000..9b7d148
--- /dev/null
+++ b/src/main/java/com/xxx/winio/AppGUI.java
@@ -0,0 +1,108 @@
+package com.xxx.winio;
+
+import com.xxx.winio.config.Config;
+import com.xxx.winio.utils.Util;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+public class AppGUI {
+ private JLabel lname;
+ private JTextField desc;
+ private JPanel panel1;
+ private JLabel pbcLable;
+ private JTextField pbcEdit;
+ private JLabel jsLable;
+ private JTextField windowWait;
+ private JTextField lowTime;
+ private JTextField upTime;
+ private JTextField virturalTime;
+ private JButton run;
+ private JButton stop;
+ private JTextField jsEdit;
+ private JTextPane cmd;
+
+ private static AppGUI gui;
+
+ public static void main(String[] args) {
+ try {
+ UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ gui = new AppGUI();
+ JFrame frame = new JFrame("PBC Hook");
+ frame.setContentPane(gui.panel1);
+ frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+ frame.pack();
+ frame.setVisible(true);
+
+ initView();
+ }
+
+ private static void initView() {
+ gui.desc.setText(Config.PC_DESC);
+ gui.pbcEdit.setText(Config.IE_EDIT);
+ gui.jsEdit.setText(Config.DEV_EDIT);
+ gui.windowWait.setText(Config.WINDOW_WAIT_TIME + "");
+ gui.lowTime.setText(Config.INPUT_LOW_WAIT_TIME + "");
+ gui.upTime.setText(Config.INPUT_UP_WAIT_TIME + "");
+ gui.virturalTime.setText(Config.INPUT_VIRTUAL_WAIT_TIME + "");
+
+ gui.run.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if (setConfig()){
+ gui.run.setEnabled(false);
+ new Thread(new Runnable() {
+ public void run() {
+ PbcApp.main(new String[0]);
+ }
+ }).start();
+ }
+ }
+ });
+
+ gui.stop.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ gui.stop.setEnabled(false);
+ PbcApp.RUN = false;
+ new Thread(new Runnable() {
+ public void run() {
+ while (true){
+ if (PbcApp.BREAK){
+ gui.run.setEnabled(true);
+ gui.stop.setEnabled(true);
+ break;
+ }
+ Util.sleep(1000);
+ }
+ }
+ }).start();
+ }
+ });
+ }
+
+ private static boolean setConfig() {
+ if (Util.isStringEmpty(gui.desc.getText())
+ || Util.isStringEmpty(gui.pbcEdit.getText())
+ || Util.isStringEmpty(gui.jsEdit.getText())
+ || Util.isStringEmpty(gui.windowWait.getText())
+ || Util.isStringEmpty(gui.lowTime.getText())
+ || Util.isStringEmpty(gui.upTime.getText())
+ || Util.isStringEmpty(gui.virturalTime.getText())) {
+ gui.cmd.setText("Can not be Empty.");
+ return false;
+ }
+
+
+ Config.PC_DESC = gui.desc.getText();
+ Config.IE_EDIT = gui.pbcEdit.getText();
+ Config.DEV_EDIT = gui.jsEdit.getText();
+ Config.WINDOW_WAIT_TIME = Long.parseLong(gui.windowWait.getText());
+ Config.INPUT_LOW_WAIT_TIME = Long.parseLong(gui.lowTime.getText());
+ Config.INPUT_UP_WAIT_TIME = Long.parseLong(gui.upTime.getText());
+ Config.INPUT_VIRTUAL_WAIT_TIME = Long.parseLong(gui.virturalTime.getText());
+ return true;
+ }
+}
diff --git a/src/main/java/com/xxx/winio/Pbc.form b/src/main/java/com/xxx/winio/Pbc.form
new file mode 100644
index 0000000..e0f6745
--- /dev/null
+++ b/src/main/java/com/xxx/winio/Pbc.form
@@ -0,0 +1,175 @@
+
+
diff --git a/src/main/java/com/xxx/winio/PbcApp.java b/src/main/java/com/xxx/winio/PbcApp.java
index 971913f..9e23b24 100644
--- a/src/main/java/com/xxx/winio/PbcApp.java
+++ b/src/main/java/com/xxx/winio/PbcApp.java
@@ -18,7 +18,12 @@
* Created by Administrator on 2018/3/27.
*/
public class PbcApp {
- public static void main(String[] args) throws Exception {
+ public static boolean RUN = false;
+ public static boolean BREAK = true;
+
+ public static void main(String[] args) {
+ RUN = true;
+ BREAK = false;
int sleepTimes = 0;
final PbcService pbc = new PbcService();
while (true){
@@ -36,6 +41,11 @@ public static void main(String[] args) throws Exception {
sleepTimes = 0;
}
}
+
+ if (!RUN){
+ BREAK = true;
+ break;
+ }
}
}
@@ -44,7 +54,7 @@ private static void loop(final PbcService pbc , List list){
pbc.showIEBrowser(new Callback() {
public boolean callback(WinDef.HWND root, WinDef.HWND current) {
//ie 打开后输入密码
- Util.sleep(2000);
+ Util.sleep(Config.WINDOW_WAIT_TIME);
String passSrc = pbcPass.getPassSrc();
pbc.inputPassword(passSrc);
// User32.INSTANCE.ShowWindow(root, SW_MINIMIZE);
@@ -52,7 +62,7 @@ public boolean callback(WinDef.HWND root, WinDef.HWND current) {
pbc.showIEDevelopTool(new Callback() {
public boolean callback(WinDef.HWND root, WinDef.HWND current) {
//调用JS
- Util.sleep(2000);
+ Util.sleep(Config.WINDOW_WAIT_TIME);
sendJSCmd(pbcPass);
//Sleep等待JS调用完成
// sleep(1000);
diff --git a/src/main/java/com/xxx/winio/config/Config.java b/src/main/java/com/xxx/winio/config/Config.java
index 1e24ef9..228de32 100644
--- a/src/main/java/com/xxx/winio/config/Config.java
+++ b/src/main/java/com/xxx/winio/config/Config.java
@@ -1,13 +1,18 @@
package com.xxx.winio.config;
public class Config {
- public final static String PC_DESC = "VM";
+ public static String PC_DESC = "VM";
/**
* IE句柄
*/
- public final static String IE_EDIT = "203E4";
- public final static String DEV_EDIT = "10392";
+ public static String IE_EDIT = "203E4";
+ public static String DEV_EDIT = "10392";
+
+ public static long WINDOW_WAIT_TIME = 2000;
+ public static long INPUT_LOW_WAIT_TIME = 300;
+ public static long INPUT_UP_WAIT_TIME = 300;
+ public static long INPUT_VIRTUAL_WAIT_TIME = 0;
public static final String API_LIST = "https://loannode.renrendai.com/credit/list";
diff --git a/src/main/java/com/xxx/winio/utils/KeyBoardUtil.java b/src/main/java/com/xxx/winio/utils/KeyBoardUtil.java
index 7b9ae5f..fd3bd1a 100644
--- a/src/main/java/com/xxx/winio/utils/KeyBoardUtil.java
+++ b/src/main/java/com/xxx/winio/utils/KeyBoardUtil.java
@@ -5,6 +5,7 @@
import com.sun.jna.platform.win32.WinUser;
import com.xxx.winio.api.User32;
import com.xxx.winio.api.VKMapping;
+import com.xxx.winio.config.Config;
import java.awt.event.KeyEvent;
@@ -62,7 +63,7 @@ public static void sendString(String string) throws Exception {
private static void pressLowerCase(Character c, Character last, Character next) throws Exception {
KBLOG += c;
KeyPress(VKMapping.toScanCode("" + c));
- Util.sleep(300);
+ Util.sleep(Config.INPUT_LOW_WAIT_TIME);
}
private static void pressUpperCase(Character c, Character last, Character next) throws Exception {
@@ -70,17 +71,17 @@ private static void pressUpperCase(Character c, Character last, Character next)
if (last == null || Character.isLowerCase(last) || Character.isDigit(last)) {
KBLOG += "#shift_d#";
KeyDown(User32.MapVirtualKeyA(KeyEvent.VK_SHIFT));
- Util.sleep(300);
+ Util.sleep(Config.INPUT_UP_WAIT_TIME);
}
KBLOG += c;
KeyPress(VKMapping.toScanCode("" + c));
- Util.sleep(300);
+ Util.sleep(Config.INPUT_UP_WAIT_TIME);
if (next == null || Character.isLowerCase(next) || Character.isDigit(next)) {
KBLOG += "#shift_u#";
KeyUp(User32.MapVirtualKeyA(KeyEvent.VK_SHIFT));
- Util.sleep(300);
+ Util.sleep(Config.INPUT_UP_WAIT_TIME);
}
}
@@ -96,7 +97,7 @@ public static void sendVirtualString(String string) {
for (int i = 0; i < string.length(); i++) {
char c = string.charAt(i);
sendVChar(c);
-// Util.sleep(10);
+ Util.sleep(Config.INPUT_VIRTUAL_WAIT_TIME);
}
}
diff --git a/src/main/java/com/xxx/winio/utils/Util.java b/src/main/java/com/xxx/winio/utils/Util.java
index 22a8736..18e6c24 100644
--- a/src/main/java/com/xxx/winio/utils/Util.java
+++ b/src/main/java/com/xxx/winio/utils/Util.java
@@ -11,6 +11,11 @@ public static void sleep(long m) {
}
}
+ public static boolean isStringEmpty(String s) {
+ if (s != null) s = s.trim();
+ return s == null || s.length() == 0;
+ }
+
public static void main(String[] args) {
System.out.println(String.format(Config.JS_TRANS, Config.PC_DESC));
}