Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
G3G4X5X6 committed Jul 8, 2022
1 parent 38c512e commit 0bcbfc0
Show file tree
Hide file tree
Showing 87 changed files with 1,197 additions and 381 deletions.
99 changes: 5 additions & 94 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,102 +22,13 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*


.idea
ultimate-app/target
ultimate-editor/target/
ultimate-nuclei/target
ultimate-shell/target
ultimate-typeahead/target
ultimate-terminal/target
ultimate-vault/target
logs
ultimate-shell/target/com/g3g4x5x6/utils/ShellConfig.java
.idea/libraries/Maven__com_alibaba_fastjson_1_2_83.xml
.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_5_9_0_M1.xml
.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_9_0_M1.xml
.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_engine_5_9_0_M1.xml
.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_params_5_9_0_M1.xml
.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_9_0_M1.xml
.idea/libraries/Maven__org_junit_platform_junit_platform_engine_1_9_0_M1.xml
buildNumber.properties
ultimate-app/buildNumber.properties
ultimate-app/ultimate-app.iml
ultimate-editor/buildNumber.properties
ultimate-nuclei/buildNumber.properties
ultimate-nuclei/ultimate-nuclei.iml
ultimate-shell/buildNumber.properties
ultimate-shell/target/com/g3g4x5x6/NewTabbedPane.java
ultimate-shell/target/com/g3g4x5x6/ssh/DropTargetListenerImpl.java
ultimate-shell/target/com/g3g4x5x6/ssh/panel/DropTargetListenerBrowserImpl.java
ultimate-shell/target/com/g3g4x5x6/ssh/panel/FilesBrowser.java
ultimate-shell/target/com/g3g4x5x6/ssh/panel/FilesBrowserTableCellRenderer.java
ultimate-shell/target/com/g3g4x5x6/ssh/panel/NewSshPane.java
ultimate-shell/target/com/g3g4x5x6/ssh/panel/SshTabbedPane.java
ultimate-shell/target/com/g3g4x5x6/ssh/panel/TaskProgressPanel.java
ultimate-shell/target/com/g3g4x5x6/ssh/SessionInfo.java
ultimate-shell/target/com/g3g4x5x6/ssh/SshSettingsProvider.java
ultimate-shell/target/com/g3g4x5x6/utils/DialogUtil.java
ultimate-shell/target/com/g3g4x5x6/utils/SessionUtil.java
ultimate-shell/target/com/g3g4x5x6/utils/TableUtil.java
ultimate-shell/target/com/g3g4x5x6/utils/TreeUtil.java
ultimate-shell/target/maven-archiver/pom.properties
ultimate-shell/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
ultimate-shell/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
ultimate-shell/ultimate-shell.iml
ultimate-terminal/buildNumber.properties
ultimate-terminal/ultimate-terminal.iml
ultimate-typeahead/buildNumber.properties
ultimate-typeahead/target/maven-archiver/pom.properties
ultimate-typeahead/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
ultimate-typeahead/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
.idea/libraries/Maven__com_alibaba_fastjson_1_2_83.xml
.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_5_9_0_M1.xml
.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_9_0_M1.xml
.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_engine_5_9_0_M1.xml
.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_params_5_9_0_M1.xml
.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_9_0_M1.xml
.idea/libraries/Maven__org_junit_platform_junit_platform_engine_1_9_0_M1.xml
buildNumber.properties
ultimate-app/buildNumber.properties
ultimate-app/ultimate-app.iml
ultimate-editor/buildNumber.properties
ultimate-nuclei/buildNumber.properties
ultimate-nuclei/ultimate-nuclei.iml
ultimate-shell/buildNumber.properties
ultimate-shell/ultimate-shell.iml
ultimate-terminal/buildNumber.properties
ultimate-terminal/ultimate-terminal.iml
ultimate-typeahead/buildNumber.properties
.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_params_5_9_0_M1.xml
.idea/libraries/Maven__com_alibaba_fastjson_1_2_83.xml
.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_5_9_0_M1.xml
.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_9_0_M1.xml
.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_engine_5_9_0_M1.xml
.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_params_5_9_0_M1.xml
.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_9_0_M1.xml
.idea/libraries/Maven__org_junit_platform_junit_platform_engine_1_9_0_M1.xml
buildNumber.properties
ultimate-app/buildNumber.properties
ultimate-app/ultimate-app.iml
ultimate-editor/buildNumber.properties
ultimate-nuclei/buildNumber.properties
ultimate-nuclei/ultimate-nuclei.iml
ultimate-shell/buildNumber.properties
ultimate-shell/ultimate-shell.iml
ultimate-terminal/buildNumber.properties
ultimate-terminal/ultimate-terminal.iml
ultimate-typeahead/buildNumber.properties
.idea/libraries/Maven__com_alibaba_fastjson_1_2_83.xml
.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_5_9_0_M1.xml
.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_9_0_M1.xml
.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_engine_5_9_0_M1.xml
.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_params_5_9_0_M1.xml
.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_9_0_M1.xml
.idea/libraries/Maven__org_junit_platform_junit_platform_engine_1_9_0_M1.xml
buildNumber.properties
ultimate-app/buildNumber.properties
ultimate-app/ultimate-app.iml
ultimate-editor/buildNumber.properties
ultimate-nuclei/buildNumber.properties
ultimate-nuclei/ultimate-nuclei.iml
ultimate-shell/buildNumber.properties
ultimate-shell/ultimate-shell.iml
ultimate-terminal/buildNumber.properties
ultimate-terminal/ultimate-terminal.iml
ultimate-typeahead/buildNumber.properties
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
[//]: # ( <img src="doc/img/cube.jpg" alt="G3G4X5X6"/>)

[//]: # (</p>)
![ultimate-cube](https://socialify.git.ci/G3G4X5X6/ultimate-cube/image?description=1&font=KoHo&forks=1&issues=1&language=1&name=1&owner=1&pattern=Brick%20Wall&pulls=1&stargazers=1&theme=Light)

![ultimate-cube](https://socialify.git.ci/G3G4X5X6/ultimate-cube/image?description=1&font=KoHo&forks=1&issues=1&language=1&owner=1&pattern=Circuit%20Board&pulls=1&stargazers=1)
# ultimate-cube

简体中文 [English](README.en.md)
Expand Down
4 changes: 2 additions & 2 deletions buildNumber.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file
#Sun Jun 26 13:25:24 CST 2022
buildNumber=26
#Mon Jul 04 17:15:43 CST 2022
buildNumber=33
12 changes: 11 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
<jSerialComm-version>2.7.0</jSerialComm-version>

<junit-jupiter-version>RELEASE</junit-jupiter-version>

<jcolor-version>5.5.1</jcolor-version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -224,6 +226,14 @@
<version>${junit-jupiter-version}</version>
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/com.diogonunes/JColor -->
<dependency>
<groupId>com.diogonunes</groupId>
<artifactId>JColor</artifactId>
<version>${jcolor-version}</version>
</dependency>

</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -337,7 +347,7 @@
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<outputDirectory>${pom.basedir/target/classes}</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/java</directory>
Expand Down
4 changes: 2 additions & 2 deletions ultimate-app/buildNumber.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file
#Sun Jun 26 13:26:07 CST 2022
buildNumber=25
#Mon Jul 04 17:17:55 CST 2022
buildNumber=41
8 changes: 8 additions & 0 deletions ultimate-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
</dependency>
<dependency>
<groupId>com.diogonunes</groupId>
<artifactId>JColor</artifactId>
</dependency>
</dependencies>

</project>
113 changes: 67 additions & 46 deletions ultimate-app/src/main/java/com/g3g4x5x6/App.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package com.g3g4x5x6;

import com.formdev.flatlaf.FlatLightLaf;
import com.formdev.flatlaf.extras.FlatSVGIcon;
import com.g3g4x5x6.dialog.LockDialog;
import com.g3g4x5x6.ssh.SessionInfo;
import com.g3g4x5x6.utils.CheckUtil;
import com.g3g4x5x6.utils.AppConfig;
import com.g3g4x5x6.utils.CheckUtil;
import com.g3g4x5x6.utils.CommonUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.log4j.PropertyConfigurator;

import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.plaf.FontUIResource;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
Expand All @@ -22,22 +23,28 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Enumeration;
import java.util.LinkedHashMap;
import java.util.Objects;
import java.util.Properties;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;

import static com.diogonunes.jcolor.Ansi.colorize;
import static com.diogonunes.jcolor.Attribute.*;
import static java.awt.Frame.NORMAL;


@Slf4j
public class App {
public static MainFrame mainFrame;
public static Properties properties = loadProperties();
public static Properties properties;
public static AtomicBoolean lockState = new AtomicBoolean(false);
public static LinkedHashMap<String, SessionInfo> sessionInfos = new LinkedHashMap<>();
public static String lockPassword = "";

public static void main(String[] args) {
// 显示旗标
showBanner();
// 加载配置
properties = loadProperties();
// 检查程序运行环境
CheckUtil.checkEnv();
// 加载自定义日志配置
Expand All @@ -61,9 +68,7 @@ private static void createGUI() {
// 初始化系统托盘
initSystemTray();

log.info("<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>");
log.info("<<<<<<<<<<<<<<<<<<<<<程序启动完成>>>>>>>>>>>>>>>>>>>>>");
log.info("<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>");
showBootstrapTips();
}

private static void initFlatLaf() {
Expand All @@ -81,18 +86,6 @@ private static void initFlatLaf() {
UIManager.put("TextComponent.arc", 5);
}

public static void initGlobalFont(Font font) {
FontUIResource fontResource = new FontUIResource(font);
for(Enumeration<Object> keys = UIManager.getDefaults().keys(); keys.hasMoreElements();) {
Object key = keys.nextElement();
Object value = UIManager.get(key);
if(value instanceof FontUIResource) {
System.out.println(key);
UIManager.put(key, fontResource);
}
}
}

private static void initSystemTray() {
/*
* 添加系统托盘
Expand All @@ -107,48 +100,51 @@ private static void initSystemTray() {
} catch (IOException e) {
e.printStackTrace();
}
// // 创建点击图标时的弹出菜单
// PopupMenu popupMenu = new PopupMenu();
//
// MenuItem openItem = new MenuItem();
// openItem.setLabel("Open");
// MenuItem exitItem = new MenuItem();
// exitItem.setLabel("Quit");
//
// openItem.addActionListener(e -> {
// // 点击打开菜单时显示窗口
// openApp();
// });
// exitItem.addActionListener(e -> {
// // 点击退出菜单时退出程序
// System.exit(0);
// });
//
// popupMenu.add(openItem);
// popupMenu.add(exitItem);


// 创建右键图标时的弹出菜单:JPopupMenu
JPopupMenu popupMenu = new JPopupMenu();

JMenuItem openMenuItem = new JMenuItem("打开");
JMenuItem exitMenuItem = new JMenuItem("退出");

openMenuItem.setIcon(new FlatSVGIcon("icons/start.svg"));
openMenuItem.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
openApp();
}
});

JMenuItem exitMenuItem = new JMenuItem("退出");
exitMenuItem.setIcon(new FlatSVGIcon("icons/exit.svg"));
exitMenuItem.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});

JMenuItem editorMenuItem = new JMenuItem("内置编辑器");
editorMenuItem.setIcon(new FlatSVGIcon("icons/editScheme.svg"));
editorMenuItem.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
MainFrame.editorFrame.setVisible(true);
}
});

JMenuItem nucleiMenuItem = new JMenuItem("Poc验证框架");
nucleiMenuItem.setIcon(new FlatSVGIcon("icons/Administrator.svg"));
nucleiMenuItem.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
MainFrame.nucleiFrame.setVisible(true);
}
});

popupMenu.add(openMenuItem);
popupMenu.addSeparator();
popupMenu.add(nucleiMenuItem);
popupMenu.add(editorMenuItem);
popupMenu.addSeparator();
popupMenu.add(exitMenuItem);

// 创建一个托盘图标
Expand Down Expand Up @@ -196,6 +192,7 @@ private static void openApp() {
lockDialog.setVisible(true);
} else {
mainFrame.setVisible(true);
mainFrame.setExtendedState(NORMAL);
}
}
}
Expand Down Expand Up @@ -231,18 +228,42 @@ private static Properties loadProperties() {
} catch (Exception ignored) {

}
log.debug(properties.toString());

CommonUtil.terminalOutput("加载程序主配置:" + properties.toString());
return properties;
}

private static void initLog4j() {
try {
if (App.properties.getProperty("app.log.setting.enable").equalsIgnoreCase("true")) {
PropertyConfigurator.configureAndWatch(App.properties.getProperty("app.log.setting.path").replace("{workspace}", AppConfig.getWorkPath()));
log.info("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<已加载自定义日志配置>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");

CommonUtil.terminalOutput("已加载自定义日志配置");
}
} catch (Exception e) {
log.debug(e.getMessage());
}
}

private static void showBanner(){
// Credits
System.out.println(colorize("==============================================================", CYAN_TEXT(), BOLD()));
System.out.print(colorize("\tPOWER BY ", BOLD(), BRIGHT_YELLOW_TEXT(), GREEN_BACK()));
System.out.println(colorize("G3G4X5X6\t", BOLD(), BRIGHT_YELLOW_TEXT(), RED_BACK()));
System.out.println(colorize("\nI hope you find it useful ;)", YELLOW_TEXT(), BOLD()));
System.out.println(colorize("==============================================================", CYAN_TEXT(), BOLD()));
}

private static void showBootstrapTips(){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println(colorize("==============================================================", CYAN_TEXT(), BOLD()));
System.out.print(colorize("\tStarted at ", BOLD(), BRIGHT_YELLOW_TEXT(), GREEN_BACK()));
System.out.println(colorize(sdf.format(new Date()) + "\t", BOLD(), BRIGHT_YELLOW_TEXT(), RED_BACK()));
System.out.println();
System.out.print(colorize("——————————————————————————————————————————————————————————————", CYAN_TEXT(), BOLD()));
System.out.println(colorize("\nGo for it!", YELLOW_TEXT(), BOLD()));
System.out.print(colorize("——————————————————————————————————————————————————————————————", CYAN_TEXT(), BOLD()));
System.out.println();
System.out.println(colorize("==============================================================", CYAN_TEXT(), BOLD()));
}
}
Loading

0 comments on commit 0bcbfc0

Please sign in to comment.