Skip to content

Commit

Permalink
fix input to output
Browse files Browse the repository at this point in the history
  • Loading branch information
source committed Nov 30, 2018
1 parent b1a90a3 commit 9e15994
Show file tree
Hide file tree
Showing 11 changed files with 168 additions and 165 deletions.
Binary file modified release/YaguraExtender.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion src/yagura/view/JReplaceDialog.form
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@
<EmptySpace pref="20" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<EmptySpace min="37" pref="37" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="37" max="-2" attributes="0"/>
<Component id="scrollPane" pref="0" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand Down
3 changes: 2 additions & 1 deletion src/yagura/view/JReplaceDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addContainerGap(20, Short.MAX_VALUE))
.addGroup(pnlCenterLayout.createSequentialGroup()
.addGap(37, 37, 37)
.addComponent(scrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addComponent(scrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addContainerGap())
);

tabMatchReplace.add(pnlCenter, java.awt.BorderLayout.CENTER);
Expand Down
224 changes: 110 additions & 114 deletions src/yagura/view/JTransCoderTab.java

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/yagura/view/LoggingTab.form
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<Component id="txtFileLimitSize" min="-2" pref="48" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="lblFileUnit" min="-2" pref="30" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="lblToolTip" min="-2" pref="224" max="-2" attributes="0"/>
</Group>
<Component id="chkHistoryLogInclude" alignment="0" min="-2" max="-2" attributes="0"/>
Expand Down
2 changes: 1 addition & 1 deletion src/yagura/view/LoggingTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(txtFileLimitSize, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(lblFileUnit, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lblToolTip, javax.swing.GroupLayout.PREFERRED_SIZE, 224, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(chkHistoryLogInclude, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnlCenterLayout.createSequentialGroup()
Expand Down
17 changes: 11 additions & 6 deletions src/yagura/view/SendToTab.form
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="chkSubmenu" min="-2" pref="133" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Component id="scrollSendTo" pref="472" max="32767" attributes="0"/>
<Component id="scrollSendTo" pref="479" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" alignment="0" groupAlignment="0" attributes="0">
<Component id="btnSendToEdit" alignment="1" min="-2" pref="83" max="-2" attributes="3"/>
<Component id="btnSendToRemove" alignment="1" min="-2" pref="83" max="-2" attributes="3"/>
<Component id="btnSendToAdd" alignment="1" min="-2" pref="83" max="-2" attributes="3"/>
Expand All @@ -65,9 +65,13 @@
</Group>
</Group>
</Group>
<EmptySpace min="-2" pref="5" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="chkSubmenu" min="-2" pref="133" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand All @@ -78,7 +82,6 @@
<Component id="chkSubmenu" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="scrollSendTo" min="-2" pref="191" max="-2" attributes="1"/>
<Group type="102" attributes="0">
<Component id="btnSendToEdit" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
Expand All @@ -89,9 +92,11 @@
<Component id="btnSendToDownArraw" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btnSendToAdd" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="111" max="32767" attributes="0"/>
</Group>
<Component id="scrollSendTo" pref="0" max="32767" attributes="1"/>
</Group>
<EmptySpace pref="59" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand Down
17 changes: 10 additions & 7 deletions src/yagura/view/SendToTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGroup(pnlCenterLayout.createSequentialGroup()
.addContainerGap()
.addGroup(pnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(chkSubmenu, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(pnlCenterLayout.createSequentialGroup()
.addComponent(scrollSendTo, javax.swing.GroupLayout.DEFAULT_SIZE, 472, Short.MAX_VALUE)
.addComponent(scrollSendTo, javax.swing.GroupLayout.DEFAULT_SIZE, 479, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
Expand All @@ -157,8 +156,11 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGap(10, 10, 10)
.addGroup(pnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(btnSendToDownArraw, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnSendToUpArraw, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE))))))
.addContainerGap())
.addComponent(btnSendToUpArraw, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(5, 5, 5))
.addGroup(pnlCenterLayout.createSequentialGroup()
.addComponent(chkSubmenu, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())))
);
pnlCenterLayout.setVerticalGroup(
pnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
Expand All @@ -167,7 +169,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(chkSubmenu)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(scrollSendTo, javax.swing.GroupLayout.PREFERRED_SIZE, 191, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(pnlCenterLayout.createSequentialGroup()
.addComponent(btnSendToEdit)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
Expand All @@ -177,8 +178,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnSendToDownArraw)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnSendToAdd)))
.addContainerGap(59, Short.MAX_VALUE))
.addComponent(btnSendToAdd)
.addGap(0, 111, Short.MAX_VALUE))
.addComponent(scrollSendTo, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addContainerGap())
);

tabSendTo.add(pnlCenter, java.awt.BorderLayout.CENTER);
Expand Down
29 changes: 12 additions & 17 deletions src/yagura/view/TabbetOption.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private void customizeComponents() {
this.addTab("JSearch", this.tabJSearch);
this.addTab("JTransCoder", this.tabJTransCoder);
this.addTab("Version", this.tabVersion);

this.tabEncoding.addPropertyChangeListener(ENCODING_PROPERTY, this);
this.tabMatchReplace.addPropertyChangeListener(MATCHREPLACE_PROPERTY, this);
this.tabMatchAlert.addPropertyChangeListener(MATCHALERT_PROPERTY, this);
Expand Down Expand Up @@ -137,7 +137,7 @@ public void setMatchReplaceProperty(MatchReplaceProperty matchReplaceProperty) {
public MatchReplaceProperty getMatchReplaceProperty() {
return this.tabMatchReplace.getMatchReplaceProperty();
}

@Override
public void setSendToProperty(SendToProperty sendToProperty) {
this.tabSendTo.setSendToProperty(sendToProperty);
Expand All @@ -147,7 +147,7 @@ public void setSendToProperty(SendToProperty sendToProperty) {
public SendToProperty getSendToProperty() {
return this.tabSendTo.getSendToProperty();
}

@Override
public void setLoggingProperty(LoggingProperty loggingProperty) {
this.tabLogging.setLoggingProperty(loggingProperty);
Expand Down Expand Up @@ -185,7 +185,7 @@ public void setAutoResponderProperty(AutoResponderProperty autoResponderProperty
public AutoResponderProperty getAutoResponderProperty() {
return this.tabAutoResponder.getAutoResponderProperty();
}

@Override
public JSearchProperty getJSearchProperty() {
return this.tabJSearch.getProperty();
Expand All @@ -195,8 +195,8 @@ public JSearchProperty getJSearchProperty() {
public void setJSearchProperty(JSearchProperty jsearch) {
this.tabJSearch.setProperty(jsearch);
}
public void setJTransCoderProperty(EncodingProperty encodingProperty) {

public void setJTransCoderProperty(EncodingProperty encodingProperty) {
this.tabJTransCoder.setEncodingList(encodingProperty.getEncodingList(), "");
}

Expand All @@ -209,7 +209,7 @@ public JTransCoderProperty getJTransCoderProperty() {
public void setJTransCoderProperty(JTransCoderProperty transcoder) {
this.tabJTransCoder.setProperty(transcoder);
}

@Override
public boolean getDebugMode() {
return this.tabVersion.getDebugMode();
Expand All @@ -219,7 +219,7 @@ public boolean getDebugMode() {
public void setDebugMode(boolean debugMode) {
this.tabVersion.setDebugMode(debugMode);
}

@Override
public void propertyChange(PropertyChangeEvent evt) {
this.firePropertyChange(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
Expand All @@ -228,7 +228,7 @@ public void propertyChange(PropertyChangeEvent evt) {
public void sendToJTransCoder(String text) {
Container container = this.getParent();
if (container instanceof JTabbedPane) {
JTabbedPane tabbet = (JTabbedPane)container;
JTabbedPane tabbet = (JTabbedPane) container;
int index = tabbet.indexOfTab(this.getTabCaption());
//BurpExtender.errPrintln("\tname u r:" + index);
if (index > -1) {
Expand All @@ -238,20 +238,15 @@ public void sendToJTransCoder(String text) {
tabbet.updateUI();
}
this.tabJTransCoder.sendToJTransCoder(text);
// Class cls = this.getParent().getClass();
// BurpExtender.errPrintln("name:" + cls.getName());
// while ((cls = cls.getSuperclass()) != null) {
// BurpExtender.errPrintln("\tname:" + cls.getName());
// }
}

public byte [] receiveFromJTransCoder() {
return this.tabJTransCoder.receiveFromJTransCoder();
public byte[] receiveFromJTransCoder() {
return this.tabJTransCoder.receiveFromJTransCoder();
}

@Override
public void extensionUnloaded() {
this.tabAutoResponder.extensionUnloaded();
}

}
14 changes: 6 additions & 8 deletions src/yagura/view/VersionTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
*/
public class VersionTab extends javax.swing.JPanel {

private OptionProperty option;

/**
* Creates new form VersionTab
*/
Expand Down Expand Up @@ -124,13 +122,13 @@ private void chkDebugModeStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-
this.firePropertyChange(TabbetOption.VERSION_PROPERTY, null, this);
}//GEN-LAST:event_chkDebugModeStateChanged

final static FileFilter burp_config_filter = new FileNameExtensionFilter("burp configファイル(*.bcxml)", "bcxml");
final static FileFilter BURP_CONFIG_FILTER = new FileNameExtensionFilter("burp configファイル(*.bcxml)", "bcxml");

private void btnImportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImportActionPerformed
JFileChooser filechooser = new JFileChooser();
filechooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
filechooser.addChoosableFileFilter(burp_config_filter);
filechooser.setFileFilter(burp_config_filter);
filechooser.addChoosableFileFilter(BURP_CONFIG_FILTER);
filechooser.setFileFilter(BURP_CONFIG_FILTER);
int selected = filechooser.showOpenDialog(this);
if (selected == JFileChooser.APPROVE_OPTION) {
try {
Expand All @@ -146,13 +144,13 @@ private void btnImportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR
private void btnExportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportActionPerformed
JFileChooser filechooser = new JFileChooser();
filechooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
filechooser.addChoosableFileFilter(burp_config_filter);
filechooser.setFileFilter(burp_config_filter);
filechooser.addChoosableFileFilter(BURP_CONFIG_FILTER);
filechooser.setFileFilter(BURP_CONFIG_FILTER);
int selected = filechooser.showSaveDialog(this);
if (selected == JFileChooser.APPROVE_OPTION) {
try {
File file = filechooser.getSelectedFile();
if (!burp_config_filter.accept(file)) {
if (!BURP_CONFIG_FILTER.accept(file)) {
file = new File(file.getAbsolutePath() + ".bcxml");
}
Config.saveToXML(file, BurpExtender.getInstance().getProperty());
Expand Down
22 changes: 13 additions & 9 deletions test/yagura/external/TransUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -414,15 +414,19 @@ public void testToUnocodeDecode() {
*/
@Test
public void testToHexEncode() {
System.out.println("testToHexEncode");
assertEquals("abcdef\\x0d\\x0a\\x21\\x22ghi\\x23\\x24\\x25jkf", TransUtil.toHexEncode("abcdef\r\n!\"ghi#$%jkf", false));
assertEquals("abcdef\\X0D\\X0A\\X21\\X22ghi\\X23\\X24\\X25jkf", TransUtil.toHexEncode("abcdef\r\n!\"ghi#$%jkf", true));

assertEquals("\\x61\\x62\\x63\\x64\\x65\\x66\\x0d\\x0a\\x21\\x22\\x67\\x68\\x69\\x23\\x24\\x25\\x6a\\x6b\\x66", TransUtil.toHexEncode("abcdef\r\n!\"ghi#$%jkf", TransUtil.PTN_ENCODE_ALL, false));
assertEquals("\\X61\\X62\\X63\\X64\\X65\\X66\\X0D\\X0A\\X21\\X22\\X67\\X68\\X69\\X23\\X24\\X25\\X6A\\X6B\\X66", TransUtil.toHexEncode("abcdef\r\n!\"ghi#$%jkf", TransUtil.PTN_ENCODE_ALL, true));

System.out.println(TransUtil.toHexEncode(" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", ENCODE_JS, false));
assertEquals(" !\\x22#$%&\\x27()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\x5c]^_`abcdefghijklmnopqrstuvwxyz{|}~", TransUtil.toHexEncode(" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", ENCODE_JS, false));
try {
System.out.println("testToHexEncode");
assertEquals("abcdef\\x0d\\x0a\\x21\\x22ghi\\x23\\x24\\x25jkf", TransUtil.toByteHexEncode("abcdef\r\n!\"ghi#$%jkf", "8859_1", false));
assertEquals("abcdef\\X0D\\X0A\\X21\\X22ghi\\X23\\X24\\X25jkf", TransUtil.toByteHexEncode("abcdef\r\n!\"ghi#$%jkf", "8859_1", true));

assertEquals("\\x61\\x62\\x63\\x64\\x65\\x66\\x0d\\x0a\\x21\\x22\\x67\\x68\\x69\\x23\\x24\\x25\\x6a\\x6b\\x66", TransUtil.toByteHexEncode(Util.getRawByte("abcdef\r\n!\"ghi#$%jkf"), TransUtil.PTN_ENCODE_ALL, false));
assertEquals("\\X61\\X62\\X63\\X64\\X65\\X66\\X0D\\X0A\\X21\\X22\\X67\\X68\\X69\\X23\\X24\\X25\\X6A\\X6B\\X66", TransUtil.toByteHexEncode(Util.getRawByte("abcdef\r\n!\"ghi#$%jkf"), TransUtil.PTN_ENCODE_ALL, true));

System.out.println(TransUtil.toByteHexEncode(" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", "8859_1", ENCODE_JS, false));
assertEquals(" !\\x22#$%&\\x27()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\x5c]^_`abcdefghijklmnopqrstuvwxyz{|}~", TransUtil.toByteHexEncode(" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", "8859_1", ENCODE_JS, false));
} catch (UnsupportedEncodingException ex) {
Logger.getLogger(TransUtilTest.class.getName()).log(Level.SEVERE, null, ex);
}
}

/**
Expand Down

0 comments on commit 9e15994

Please sign in to comment.