use of com.jsql.view.swing.scrollpane.LightScrollPane in project jsql-injection by ron190.
the class CreateShellTab method execute.
@Override
public void execute() {
if (MediatorGui.frame() == null) {
LOGGER.error("Unexpected unregistered MediatorGui.frame() in " + this.getClass());
}
try {
UUID terminalID = UUID.randomUUID();
ShellWeb terminal = new ShellWeb(terminalID, this.url);
MediatorGui.frame().getConsoles().put(terminalID, terminal);
LightScrollPane scroller = new LightScrollPaneShell(terminal);
MediatorGui.tabResults().addTab("Web shell ", scroller);
// Focus on the new tab
MediatorGui.tabResults().setSelectedComponent(scroller);
// Create a custom tab header with close button
TabHeader header = new TabHeader("Web shell", HelperUi.ICON_SHELL_SERVER);
MediatorGui.tabResults().setToolTipTextAt(MediatorGui.tabResults().indexOfComponent(scroller), "<html><b>URL</b><br>" + this.url + RessourceAccess.FILENAME_WEBSHELL + "<br><b>Path</b><br>" + this.path + RessourceAccess.FILENAME_WEBSHELL + "</html>");
// Apply the custom header to the tab
MediatorGui.tabResults().setTabComponentAt(MediatorGui.tabResults().indexOfComponent(scroller), header);
terminal.requestFocusInWindow();
} catch (MalformedURLException e) {
LOGGER.warn("Incorrect shell Url", e);
}
}
use of com.jsql.view.swing.scrollpane.LightScrollPane in project jsql-injection by ron190.
the class SqlEngine method initErrorTabs.
private void initErrorTabs() {
SqlEngine.TAB_ERROR.removeAll();
if (xmlModel.getStrategy().getError() != null) {
for (Method methodError : xmlModel.getStrategy().getError().getMethod()) {
JPanel panelError = new JPanel(new BorderLayout());
final Method[] m = new Method[] { methodError };
JTextPaneLexer textPane = new JTextPaneLexer(false) {
@Override
public void switchSetterToVendor() {
this.attributeSetter = new AttributeSetterForVendor(m[0], "setQuery");
}
};
SqlEngine.resetLexer(textPane);
textPane.switchSetterToVendor();
textPane.setText(methodError.getQuery().trim());
textPane.setBorder(SqlEngine.BORDER_RIGHT);
panelError.add(new LightScrollPane(1, 0, 1, 0, textPane), BorderLayout.CENTER);
JPanel panelLimit = new JPanel();
panelLimit.setLayout(new BoxLayout(panelLimit, BoxLayout.LINE_AXIS));
panelLimit.add(new JLabel(" Overflow limit: "));
panelLimit.add(new JTextField(Integer.toString(methodError.getCapacity())));
panelError.add(panelLimit, BorderLayout.SOUTH);
SqlEngine.TAB_ERROR.addTab(methodError.getName(), panelError);
SqlEngine.TAB_ERROR.setTitleAt(SqlEngine.TAB_ERROR.getTabCount() - 1, "<html><div style=\"text-align:left;width:150px;\">" + methodError.getName() + "</div></html>");
}
}
}
use of com.jsql.view.swing.scrollpane.LightScrollPane in project jsql-injection by ron190.
the class TabResults method createSQLShellTab.
public void createSQLShellTab(String url, String user, String pass, String path) {
try {
var terminalID = UUID.randomUUID();
var terminal = new ShellSql(terminalID, url, user, pass);
MediatorHelper.frame().getConsoles().put(terminalID, terminal);
LightScrollPane scroller = new LightScrollPaneShell(terminal);
this.addTab("SQL shell ", scroller);
// Focus on the new tab
this.setSelectedComponent(scroller);
// Create a custom tab header with close button
var header = new TabHeader("SQL shell", UiUtil.ICON_SHELL_SERVER);
this.setToolTipTextAt(this.indexOfComponent(scroller), String.format("<html><b>URL</b><br>%s%s<br><b>Path</b><br>%s%s</html>", url, MediatorHelper.model().getResourceAccess().filenameSqlshell, path, MediatorHelper.model().getResourceAccess().filenameSqlshell));
// Apply the custom header to the tab
this.setTabComponentAt(this.indexOfComponent(scroller), header);
terminal.requestFocusInWindow();
} catch (MalformedURLException e) {
LOGGER.log(LogLevel.CONSOLE_ERROR, "Incorrect shell Url", e);
}
}
use of com.jsql.view.swing.scrollpane.LightScrollPane in project jsql-injection by ron190.
the class Menubar method initializeItemReportIssue.
private JMenuItem initializeItemReportIssue() {
JMenuItem itemReportIssue = new JMenuItemWithMargin(I18nUtil.valueByKey("MENUBAR_COMMUNITY_REPORTISSUE"), 'R');
I18nViewUtil.addComponentForKey("MENUBAR_COMMUNITY_REPORTISSUE", itemReportIssue);
itemReportIssue.addActionListener(actionEvent -> {
var panel = new JPanel(new BorderLayout());
final JTextArea textarea = new JPopupTextArea(new JTextArea()).getProxy();
textarea.setFont(new Font(UiUtil.FONT_NAME_MONOSPACED, Font.PLAIN, UIManager.getDefaults().getFont("TextField.font").getSize()));
textarea.setText("## What's the expected behavior?\n\n" + "## What's the actual behavior?\n\n" + "## Any other detailed information on the Issue?\n\n" + "## Steps to reproduce the problem\n\n" + " 1. ...\n" + " 2. ...\n\n" + "## [Community] Request for new feature\n\n");
panel.add(new JLabel("Describe your issue or the bug you encountered :"), BorderLayout.NORTH);
panel.add(new LightScrollPane(1, 1, 1, 1, textarea));
panel.setPreferredSize(new Dimension(400, 250));
panel.setMinimumSize(new Dimension(400, 250));
textarea.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
super.mousePressed(e);
textarea.requestFocusInWindow();
}
});
int result = JOptionPane.showOptionDialog(MediatorHelper.frame(), panel, "Report an issue or a bug", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { "Report", I18nUtil.valueByKey("LIST_ADD_VALUE_CANCEL") }, I18nUtil.valueByKey("LIST_ADD_VALUE_CANCEL"));
if (StringUtils.isNotEmpty(textarea.getText()) && result == JOptionPane.YES_OPTION) {
MediatorHelper.model().getMediatorUtils().getGitUtil().sendReport(textarea.getText(), ShowOnConsole.YES, "Report");
}
});
return itemReportIssue;
}
use of com.jsql.view.swing.scrollpane.LightScrollPane in project jsql-injection by ron190.
the class PanelConsoles method initializeTabsConsoles.
private void initializeTabsConsoles() {
this.chunkTextArea = new JPopupTextArea(new JTextAreaPlaceholderConsole("Raw data extracted during injection")).getProxy();
this.chunkTextArea.setEditable(false);
this.binaryTextArea = new JPopupTextArea(new JTextAreaPlaceholderConsole("Characters extracted during blind or time injection")).getProxy();
this.binaryTextArea.setEditable(false);
this.chunkTextArea.setLineWrap(true);
this.binaryTextArea.setLineWrap(true);
var consoleTextPane = new SimpleConsoleAdapter("Console", "Event logging");
// Object creation after customization
consoleTextPane.getProxy().setEditable(false);
JTextPaneAppender.register(consoleTextPane);
this.tabConsoles.setUI(new CustomMetalTabbedPaneUI() {
@Override
protected int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics) {
return Math.max(80, super.calculateTabWidth(tabPlacement, tabIndex, metrics));
}
});
this.tabConsoles.setBorder(BorderFactory.createEmptyBorder(1, 0, 0, 0));
this.buildI18nTab("CONSOLE_MAIN_LABEL", "CONSOLE_MAIN_TOOLTIP", UiUtil.ICON_CONSOLE, new LightScrollPane(1, 0, 0, 0, consoleTextPane.getProxy()), 0);
// Order is important
var preferences = Preferences.userRoot().node(InjectionModel.class.getName());
if (preferences.getBoolean(UiUtil.JAVA_VISIBLE, false)) {
this.insertJavaTab();
}
if (preferences.getBoolean(UiUtil.NETWORK_VISIBLE, true)) {
this.insertNetworkTab();
}
if (preferences.getBoolean(UiUtil.CHUNK_VISIBLE, true)) {
this.insertChunkTab();
}
if (preferences.getBoolean(UiUtil.BINARY_VISIBLE, true)) {
this.insertBooleanTab();
}
// Reset Font when tab is selected
this.tabConsoles.addChangeListener(changeEvent -> {
JTabbedPane tabs = this.tabConsoles;
if (tabs.getSelectedIndex() > -1) {
var currentTabHeader = tabs.getTabComponentAt(tabs.getSelectedIndex());
if (currentTabHeader != null) {
currentTabHeader.setFont(currentTabHeader.getFont().deriveFont(Font.PLAIN));
currentTabHeader.setForeground(Color.BLACK);
}
}
});
}
Aggregations