Skip to content

Commit

Permalink
IP v4 Address Paste対応
Browse files Browse the repository at this point in the history
  • Loading branch information
isayan committed Jul 3, 2024
1 parent 40f57cb commit 98d8416
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 17 deletions.
Binary file modified release/YaguraExtension-v3.1.jar
Binary file not shown.
2 changes: 0 additions & 2 deletions src/main/java/yagura/model/Logging.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ protected File mkLogZip(String logBaseDir, String logdirFormat) throws IOExcepti
break;
}
} while (true);
BurpExtension.helpers().outPrintln("TargetZip:" + targetZip.getAbsolutePath());
return targetZip;
}

Expand Down Expand Up @@ -202,7 +201,6 @@ protected File mkLogDir(String logBaseDir, String logdirFormat) throws IOExcepti
break;
}
} while (true);
BurpExtension.helpers().outPrintln("TargetDir:" + targetDir.getAbsolutePath());
return targetDir;
}

Expand Down
25 changes: 18 additions & 7 deletions src/main/java/yagura/view/JTransCoderTab.form
Original file line number Diff line number Diff line change
Expand Up @@ -2793,36 +2793,39 @@
<Group type="102" alignment="0" attributes="0">
<Component id="pnlDotDecIP" min="-2" pref="300" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="lblIPValid" pref="673" max="32767" attributes="0"/>
<Component id="btnDecIPPaste" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="84" max="-2" attributes="0"/>
<Component id="lblIPValid" pref="517" max="32767" attributes="0"/>
</Group>
<Component id="txtDotOctIP" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="btnOctIP" max="32767" attributes="0"/>
<Component id="btnDecIPConvert" alignment="0" max="32767" attributes="0"/>
<Component id="btnHexIP" alignment="0" max="32767" attributes="0"/>
<Component id="btnDotOctIP" alignment="0" max="32767" attributes="0"/>
<Component id="btnDotHexIP" alignment="0" max="32767" attributes="0"/>
<Component id="btnIntIP" alignment="0" max="32767" attributes="0"/>
<Component id="btnDecIPConvert" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="lblDotDeclIP" alignment="0" max="32767" attributes="0"/>
<Component id="lblIPValid" alignment="0" max="32767" attributes="0"/>
<Component id="pnlDotDecIP" alignment="0" max="32767" attributes="0"/>
</Group>
<Component id="btnDecIPConvert" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="btnDecIPConvert" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="btnDecIPPaste" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
Expand Down Expand Up @@ -3011,6 +3014,14 @@
<Property name="toolTipText" type="java.lang.String" value=""/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="btnDecIPPaste">
<Properties>
<Property name="text" type="java.lang.String" value="Paste"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnDecIPPasteActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
Expand Down
40 changes: 32 additions & 8 deletions src/main/java/yagura/view/JTransCoderTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,7 @@ private void initComponents() {
txtIntIP = new javax.swing.JTextField();
btnIntIP = new javax.swing.JButton();
lblIPValid = new javax.swing.JLabel();
btnDecIPPaste = new javax.swing.JButton();

setLayout(new java.awt.BorderLayout());

Expand Down Expand Up @@ -2442,6 +2443,13 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
lblIPValid.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
lblIPValid.setToolTipText("");

btnDecIPPaste.setText("Paste");
btnDecIPPaste.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnDecIPPasteActionPerformed(evt);
}
});

javax.swing.GroupLayout tabIPFormatConverterLayout = new javax.swing.GroupLayout(tabIPFormatConverter);
tabIPFormatConverter.setLayout(tabIPFormatConverterLayout);
tabIPFormatConverterLayout.setHorizontalGroup(
Expand All @@ -2464,29 +2472,32 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGroup(tabIPFormatConverterLayout.createSequentialGroup()
.addComponent(pnlDotDecIP, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lblIPValid, javax.swing.GroupLayout.DEFAULT_SIZE, 673, Short.MAX_VALUE))
.addComponent(btnDecIPPaste, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(84, 84, 84)
.addComponent(lblIPValid, javax.swing.GroupLayout.DEFAULT_SIZE, 517, Short.MAX_VALUE))
.addComponent(txtDotOctIP))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(tabIPFormatConverterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(tabIPFormatConverterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnOctIP, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnDecIPConvert, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnHexIP, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnDotOctIP, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnDotHexIP, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnIntIP, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(btnIntIP, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnDecIPConvert, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
tabIPFormatConverterLayout.setVerticalGroup(
tabIPFormatConverterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tabIPFormatConverterLayout.createSequentialGroup()
.addContainerGap()
.addGroup(tabIPFormatConverterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tabIPFormatConverterLayout.createSequentialGroup()
.addContainerGap()
.addGroup(tabIPFormatConverterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(tabIPFormatConverterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(lblDotDeclIP, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblIPValid, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(pnlDotDecIP, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addComponent(btnDecIPConvert))
.addComponent(pnlDotDecIP, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(btnDecIPConvert))
.addComponent(btnDecIPPaste))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(tabIPFormatConverterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnDotOctIP)
Expand Down Expand Up @@ -3636,6 +3647,18 @@ private void btnSHAKE256ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F
}
}//GEN-LAST:event_btnSHAKE256ActionPerformed

private void btnDecIPPasteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDecIPPasteActionPerformed
try {
byte ipv4 [] = IpUtil.parseIPv4AddressByte(SwingUtil.systemClipboardPaste());
this.txtDec1.setText(String.valueOf(Byte.toUnsignedInt(ipv4[0])));
this.txtDec2.setText(String.valueOf(Byte.toUnsignedInt(ipv4[1])));
this.txtDec3.setText(String.valueOf(Byte.toUnsignedInt(ipv4[2])));
this.txtDec4.setText(String.valueOf(Byte.toUnsignedInt(ipv4[4])));
} catch (ParseException ex) {
logger.log(Level.SEVERE, ex.getMessage(), ex);
}
}//GEN-LAST:event_btnDecIPPasteActionPerformed

private final java.awt.event.ActionListener historyActionPerformed = new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
Expand All @@ -3658,6 +3681,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
private javax.swing.ButtonGroup btnConvertCase;
private javax.swing.JButton btnDecCopy;
private javax.swing.JButton btnDecIPConvert;
private javax.swing.JButton btnDecIPPaste;
private javax.swing.JButton btnDecode;
private javax.swing.JButton btnDotHexIP;
private javax.swing.JButton btnDotOctIP;
Expand Down
32 changes: 32 additions & 0 deletions src/main/java/yagura/view/ipv4.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* The MIT License
*
* Copyright 2024 isayan.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package yagura.view;

/**
*
* @author isayan
*/
class ipv4 {

}

0 comments on commit 98d8416

Please sign in to comment.