├── BitByByte.jar
├── README.md
├── bin
└── filePumper
│ ├── filePumper$1.class
│ ├── filePumper$2.class
│ ├── filePumper$3.class
│ └── filePumper.class
├── faucet.png
├── images
├── eclipse.png
├── exampleprogram.gif
├── screenshot.PNG
├── screenshot1.PNG
└── screenshot2.PNG
└── src
└── filePumper
└── filePumper.java
/BitByByte.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Perfectdotexe/BitByByte-File-Pumper/77d22b4bbb25b735df45baaed3b15fae583aa1db/BitByByte.jar
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ⭐️ Star the project on GitHub — it helps! ⭐️
6 |
7 | ## 🖥 BitByByte-File-Pumper
8 | Increases the size of a file by adding null hexadecimal value(s) (00) to the end depending on the amount the user wants in KB, MB, or GB. Usually, anti-virus softwares ignore files bigger than 100 MB therefore qualifiying this file pumper useful in that situation. Another way it could be used is for phishing or testing a network/thumb drives transfer speed. Above all, this is a penetration testing tool/utility, not a black hat tool.
9 |
10 | ## ⏱ Motivation
11 | The graphical user interface was programmed line by line, I didn't use WindowBuilder (Eclipse) to make the GUI. Reasoning why is that I took this up as a challenge to better understand how GUI's work using Java and low-level functions. Also, it is user friendly and I'm not responsible for any damages.
12 |
13 | ## 📸 Screenshots
14 | 


15 |
16 | ## 💻 Tech/framework used
17 | - [Eclipse](https://www.eclipse.org/)
18 | - [Java](https://www.java.com/)
19 |
20 | ## 💡 Features
21 | Write once, run anywhere. Currently there isn't a file pumper out there programmed in Java, there was one, but it's gone now.
22 |
23 | ## 🧠 Code Example
24 | ```public void actionPerformed(java.awt.event.ActionEvent evt) {
25 | int valueUserMain = (Integer) valueBox.getValue(); // Grabs valueBox value.
26 | byte[] nullValue = new byte [1]; // Placeholder for length.
27 | FileChannel rwChannel = null;
28 | writeRead = rwChannel.map(FileChannel.MapMode.READ_WRITE, 0, nullValue.length * valueUserMain * x.get() / 2); // Multiples and divides for correct file size.
29 | for (int i1 = 0; i1 < valueUserMain; i1++) // Creates a for loop based on the valueUserMain value.
30 | {
31 | try {
32 | rwChannel.write(writeRead); // Writes data according to writeRead multiplication/division.
33 | } catch (IOException e) {
34 | e.printStackTrace();
35 | } while (i1 == valueUserMain);
36 | ```
37 |
38 | **Data table:**
39 | **8 BITS = 1 BYTE**
40 | **1000 BYTE = 1 KB**
41 | **1000 KB = 1 MB**
42 | **1000 MB = 1 GB**
43 |
44 | ## 💼 Installation
45 | You can download the JAR file here.
46 |
47 | ## 🔨 How to use?
48 | Example: Step increment of 1 input value = 1 KB/MB/GB
49 | Minimum: 1 for KB, MB, and GB. Maximum: 999 for KB and MB. 1 for GB.
50 | If no radio button is selected default is KB automatically.
51 |
52 | ## 🔑 Contribute
53 | If you would like to contribute, just fork and push an update or make an issue.
54 |
55 | ## 📚 License
56 | Creative Commons Attribution 4.0 International License. Perfect.exe
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/bin/filePumper/filePumper$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Perfectdotexe/BitByByte-File-Pumper/77d22b4bbb25b735df45baaed3b15fae583aa1db/bin/filePumper/filePumper$1.class
--------------------------------------------------------------------------------
/bin/filePumper/filePumper$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Perfectdotexe/BitByByte-File-Pumper/77d22b4bbb25b735df45baaed3b15fae583aa1db/bin/filePumper/filePumper$2.class
--------------------------------------------------------------------------------
/bin/filePumper/filePumper$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Perfectdotexe/BitByByte-File-Pumper/77d22b4bbb25b735df45baaed3b15fae583aa1db/bin/filePumper/filePumper$3.class
--------------------------------------------------------------------------------
/bin/filePumper/filePumper.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Perfectdotexe/BitByByte-File-Pumper/77d22b4bbb25b735df45baaed3b15fae583aa1db/bin/filePumper/filePumper.class
--------------------------------------------------------------------------------
/faucet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Perfectdotexe/BitByByte-File-Pumper/77d22b4bbb25b735df45baaed3b15fae583aa1db/faucet.png
--------------------------------------------------------------------------------
/images/eclipse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Perfectdotexe/BitByByte-File-Pumper/77d22b4bbb25b735df45baaed3b15fae583aa1db/images/eclipse.png
--------------------------------------------------------------------------------
/images/exampleprogram.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Perfectdotexe/BitByByte-File-Pumper/77d22b4bbb25b735df45baaed3b15fae583aa1db/images/exampleprogram.gif
--------------------------------------------------------------------------------
/images/screenshot.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Perfectdotexe/BitByByte-File-Pumper/77d22b4bbb25b735df45baaed3b15fae583aa1db/images/screenshot.PNG
--------------------------------------------------------------------------------
/images/screenshot1.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Perfectdotexe/BitByByte-File-Pumper/77d22b4bbb25b735df45baaed3b15fae583aa1db/images/screenshot1.PNG
--------------------------------------------------------------------------------
/images/screenshot2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Perfectdotexe/BitByByte-File-Pumper/77d22b4bbb25b735df45baaed3b15fae583aa1db/images/screenshot2.PNG
--------------------------------------------------------------------------------
/src/filePumper/filePumper.java:
--------------------------------------------------------------------------------
1 | /*
2 | Program: File pumper
3 | Description: Increases the size of a file by adding null hexadecimal values (00) to the end depending on the amount the user wants in KB, MB, GB, or TB.
4 | Last modified: 6/12/19
5 | Alias: Perfect.exe
6 | Github: https://github.com/Perfectdotexe
7 | Blog: https://ewhitehat.com/
8 | *Cybersecurity student
9 | */
10 |
11 | package filePumper; // Package for program.
12 |
13 | //Important Java utilities necessary for program to function.
14 | import javax.swing.*; // Open entire javax.swing library for the GUI.
15 | import java.awt.Font; // The Font class represents fonts, which are used to render text in a visible way.
16 | import java.awt.Color; // The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary color spaces identified by a ColorSpace.
17 | import java.awt.BorderLayout; // A border layout lays out a container, arranging and resizing its components to fit in five regions: north, south, east, west, and center.
18 | import java.awt.event.*; // Opens entire java.awt.event library. Imported for MouseAdapter, MouseEvent, and ActionListener.
19 | import java.awt.Dimension; // The Dimension class encapsulates the width and height of a component (in integer precision) in a single object.
20 | import javax.swing.JRadioButton; // An implementation of a radio button -- an item that can be selected or deselected, and which displays its state to the user.
21 | import java.io.FileNotFoundException; // This exception will be thrown by the FileInputStream, FileOutputStream, and RandomAccessFile constructors when a file with the specified pathname does not exist.
22 | import java.io.IOException; // Signals that an I/O exception of some sort has occurred.
23 | import java.io.RandomAccessFile; // Instances of this class support both reading and writing to a random access file.
24 | import java.nio.channels.FileChannel; // A file channel is a SeekableByteChannel that is connected to a file. Writes bytes to file.
25 | import javax.swing.event.ChangeEvent; // ChangeEvent is used to notify interested parties that state has changed in the event source. This is used for the valueBox.
26 | import javax.swing.event.ChangeListener; // Defines an object which listens for ChangeEvents. This is used for the JSpinner.
27 | import java.nio.ByteBuffer; // Byte buffers can be created either by allocation, which allocates space for the buffer's content, or by wrapping an existing byte array into a buffer.
28 | import javax.swing.UIManager; // UIManager manages the current look and feel, the set of available look and feels, PropertyChangeListeners that are notified when the look and feel changes, look and feel defaults, and convenience methods for obtaining various default values.
29 | import java.util.concurrent.atomic.AtomicInteger; // An integer value that may be updated atomically.
30 |
31 | //Define object
32 | public class filePumper // Class head
33 | {
34 |
35 | public static void main(String[] args) throws IOException, FileNotFoundException // Main method
36 | {
37 |
38 | String currentUser = System.getProperty("user.name"); // Declares string currentUser with the initialization of the current Windows user.
39 |
40 | // === *** MAIN JFRAME *** ===
41 | JFrame mainWindow = new JFrame("BitByByte"); // Creates new window with the title "BitByByte"
42 | mainWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Exit the program on close of the frame.
43 | ImageIcon iconFaucet = new ImageIcon("faucet.png"); // Creates new ImageIcon object.
44 | mainWindow.setIconImage(iconFaucet.getImage()); // Sets icon from ImageIcon object value.
45 | mainWindow.setResizable(false); // Disables re-sizing.
46 | mainWindow.setLocationRelativeTo(null); // Center JFrame window.
47 |
48 | // *** TEXT BOX ***
49 | JTextField textBox = new JTextField("Input a valid file pathway here or click \"Open File\"..."); // Creates new text box with "Choose a file.." as the default text.
50 | textBox.setHorizontalAlignment(JTextField.CENTER);
51 | textBox.setBorder(javax.swing.BorderFactory.createEmptyBorder()); // Removes blue border around text box.
52 | textBox.setPreferredSize(new Dimension(445,25)); // Resizes text box, so they user can see the file directory.
53 | textBox.addMouseListener(new MouseAdapter() { // Adds listener to the mouse.
54 | @Override // Overrides parent class.
55 | public void mouseClicked(MouseEvent e) { // Declares mouse event when mouse is clicked.
56 | textBox.setText(""); // Sets text value to blank.
57 | textBox.setHorizontalAlignment(JTextField.LEFT); // Sets text to left.
58 | }
59 | });
60 |
61 | // *** TEXT BOX FOR VALUE ***
62 | JSpinner valueBox = new JSpinner();
63 | valueBox.setPreferredSize(new Dimension(171,25)); // Set sizing on text box.
64 | valueBox.setBorder(javax.swing.BorderFactory.createEmptyBorder()); // Removes border from text box.
65 | valueBox.setModel(new javax.swing.SpinnerNumberModel(1, 1, 999, 1)); // Default: Initial = 1, Minimum= 1, Maximum = 999, and Size per step = 1.
66 | valueBox.addChangeListener(new ChangeListener() { // Creates listener for new value.
67 | @Override
68 | public void stateChanged(ChangeEvent e) {
69 | }
70 | });
71 |
72 | // *** FILE OPEN BUTTON ***
73 | JPanel openPanel = new JPanel();
74 | openPanel.setLayout(new BorderLayout());
75 | JButton opnButt = new JButton("Open File");
76 | opnButt.setBorderPainted(false); // Removes border paint.
77 | opnButt.setFocusPainted(false); // Removes blue focus ring around the button.
78 | opnButt.addActionListener(new ActionListener() {
79 | @Override
80 | public void actionPerformed(ActionEvent arg0) {
81 | JFileChooser openFile = new JFileChooser();
82 | openFile.setCurrentDirectory(new java.io.File("C:\\Users\\" + currentUser)); // Sets default user directory to Windows user.
83 | openFile.setDialogTitle("Select a Valid File"); // Changes title of Open File
84 | openFile.setFileSelectionMode(JFileChooser.FILES_ONLY); // Takes files only.
85 | if (openFile.showOpenDialog(opnButt) == JFileChooser.APPROVE_OPTION){ // Checks to see if file.
86 | textBox.getText().replace("\t","\\"); // Adds extra / to existing / due to Java purposes.
87 | textBox.setHorizontalAlignment(JTextField.LEFT); // Sets text to left.
88 | textBox.setText(openFile.getSelectedFile().getAbsolutePath()); // Grabs full path to file.
89 | }
90 | }
91 | });
92 |
93 | // *** PANEL DECLARATIONS ***
94 | JPanel texty = new JPanel(); // Creates new JPanel for grid
95 | JPanel butty = new JPanel(); // Creates new JPanel for grid
96 |
97 | // *** RADIO BUTTONS ***
98 | int kiloValue = 1000; // 1 KB
99 | int megaValue = 1048576; // 1 MB
100 | int gigaValue = 1073741824; // 1 GB
101 | AtomicInteger x = new AtomicInteger(1000); // Place holder to avoid error default KB.
102 |
103 | JRadioButton kiloByte = new JRadioButton ("Kilobyte(s)");
104 | kiloByte.addActionListener(new ActionListener() {
105 | @Override
106 | public void actionPerformed(ActionEvent e) {
107 | valueBox.setModel(new javax.swing.SpinnerNumberModel(1, 1, 999, 1)); // Initial = 1, Minimum= 1, Maximum = 999, and Size per step = 1.
108 | x.set (kiloValue);
109 | }
110 | });
111 |
112 | JRadioButton megaByte = new JRadioButton ("Megabyte(s)");
113 | megaByte.addActionListener(new ActionListener() {
114 | @Override
115 | public void actionPerformed(ActionEvent e) {
116 | valueBox.setModel(new javax.swing.SpinnerNumberModel(1, 1, 999, 1)); // Initial = 1, Minimum= 1, Maximum = 999, and Size per step = 1.
117 | x.set (megaValue);
118 | }
119 | });
120 |
121 | JRadioButton gigaByte = new JRadioButton ("Gigabyte");
122 | gigaByte.addActionListener(new ActionListener() {
123 | @Override
124 | public void actionPerformed(ActionEvent e) {
125 | valueBox.setModel(new javax.swing.SpinnerNumberModel(1, 1, 1, 1)); // Initial = 1, Minimum= 1, Maximum = 1, and Size per step = 1.
126 | x.set (gigaValue);
127 | }
128 | });
129 |
130 | ButtonGroup groupButton = new ButtonGroup(); // Groups radio buttons which allows only one selection.
131 | groupButton.add(kiloByte);
132 | groupButton.add(megaByte);
133 | groupButton.add(gigaByte);
134 |
135 | JPanel radioList = new JPanel(); // Creates JPanel for GUI.
136 | radioList.add(valueBox);
137 | radioList.add(kiloByte);
138 | radioList.add(megaByte);
139 | radioList.add(gigaByte);
140 |
141 | // *** BUTTOM PUMP FILE GUI ***
142 | JButton buttonPump = new JButton("Pump those hexadecimals!"); // Creates button.
143 | buttonPump.setBorderPainted(false); // Removes border paint.
144 | buttonPump.setFocusPainted(false); // Removes blue focus ring around the button.
145 |
146 | // ** ACTUAL PROGRAM ***
147 | buttonPump.addActionListener(new ActionListener() {
148 | private RandomAccessFile accFile;
149 | @Override
150 | public void actionPerformed(java.awt.event.ActionEvent evt) {
151 | int valueUserMain = (Integer) valueBox.getValue(); // Grabs valueBox value.
152 | byte[] nullValue = new byte [1]; // Placeholder for length.
153 | FileChannel readWrite = null;
154 | try {
155 | accFile = new RandomAccessFile(textBox.getText(), "rw");
156 | readWrite = accFile.getChannel();
157 | } catch (FileNotFoundException e3) { // File not found error.
158 | JOptionPane.showMessageDialog(null, "File has not been found, closing with error.", "Error", JOptionPane.PLAIN_MESSAGE);
159 | System.exit(0); // Exits program.
160 | e3.printStackTrace();
161 | }
162 | ByteBuffer writeRead = null;
163 | try {
164 | accFile.seek(accFile.length());
165 | writeRead = readWrite.map(FileChannel.MapMode.READ_WRITE, 0, nullValue.length * valueUserMain * x.get() / 2); // Multiples and divides for correct file size.
166 | readWrite.position(accFile.length()); // Finds EOF.
167 | } catch (IOException e2) {
168 | e2.printStackTrace();
169 | }
170 | for (int i1 = 0; i1 < valueUserMain; i1++) // Creates a for loop based on the valueUserMain value.
171 | {
172 | try {
173 | readWrite.write(writeRead); // Writes data according to writeRead multiplication/division.
174 | } catch (IOException e) {
175 | e.printStackTrace();
176 | } while (i1 == valueUserMain);
177 | }
178 | UIManager.put("OptionPane.background", Color.black);
179 | UIManager.put("Panel.background", Color.black);
180 | UIManager.put("OptionPane.messageForeground", Color.white);
181 | JOptionPane.showMessageDialog(null, "File has been pumped", "Completed!", JOptionPane.PLAIN_MESSAGE);
182 | try {
183 | readWrite.close(); // Closes stream.
184 | } catch (IOException e) {
185 | e.printStackTrace();
186 | }
187 | System.exit(0); // Exits program when finished.
188 | }
189 | });
190 |
191 | // ** INFO BUTTON ***
192 | JButton buttonInfo = new JButton("More information"); // Creates button for more information.
193 | buttonInfo.setBorderPainted(false); // Removes border paint.
194 | buttonInfo.setFocusPainted(false); // Removes blue focus ring around the button.
195 | buttonInfo.addActionListener(new ActionListener() { // Creates action listener to see if button is clicked.
196 | @Override
197 | public void actionPerformed(java.awt.event.ActionEvent evt) {
198 | UIManager.put("OptionPane.background", Color.black);
199 | UIManager.put("Panel.background", Color.black);
200 | UIManager.put("OptionPane.messageForeground", Color.white);
201 | JOptionPane.showMessageDialog(null, "Data Measurement Chart*"
202 | + "\n8 BITS = 1 BYTE" + "\n1000 BYTE = 1 KB" + "\n1000 KB = 1 MB" + "\n1000 MB = 1 GB"
203 | + "\nExample: Step increment of 1 input value = 1 KB/MB/GB" + "\n*Minimum: 1 for KB, MB, and GB." + "\nMaximum: 999 for KB and MB. 1 for GB."
204 | + "\nIf no radio button is selected default is KB automatically."
205 | + "\nMade by: https://github.com/Perfectdotexe", "How to use BitByByte", JOptionPane.INFORMATION_MESSAGE);
206 | }
207 | });
208 |
209 | texty.add(textBox); // Adds textBox to panel.
210 | mainWindow.getContentPane().add(texty, BorderLayout.NORTH); // Attaches the texty JPanel mainwindow.
211 |
212 | butty.add(opnButt); // Adds opnButt to butty Panel.
213 | butty.add(buttonPump); // Adds buttonPump to butty Panel.
214 | butty.add(buttonInfo); // Adds buttonInfo to butty Panel.
215 |
216 | mainWindow.getContentPane().add(butty, BorderLayout.SOUTH); // Attaches the butty JPanel mainwindow.
217 |
218 | mainWindow.getContentPane().add(radioList, BorderLayout.CENTER); // Attaches the butty JPanel mainwindow.
219 |
220 | mainWindow.pack(); // Sizes the frame so that all its contents are at or above their preferred sizes.
221 |
222 | // === *** GUI VISUAL SETTINGS *** ===
223 | kiloByte.setBackground(Color.black); // Sets kiloByte radio background to black.
224 | kiloByte.setForeground(Color.white); // Sets kiloByte radio text to white.
225 | kiloByte.requestFocusInWindow(); // Disables auto focus on textBox.
226 |
227 | mainWindow.setVisible(true); // Disables auto focus on textBox.
228 | mainWindow.setSize(500, 150); // Size of the window (Width by height)
229 | mainWindow.setVisible(true); // Make the frame visible on the screen via execution.
230 | mainWindow.getContentPane().setBackground(Color.black); // Sets Jframe butty background to black.
231 |
232 | megaByte.setBackground(Color.black); // Sets megaByte radio background to black.
233 | megaByte.setForeground(Color.white); // Sets megaByte radio text to white.
234 |
235 | gigaByte.setBackground(Color.black); // Sets gigaByte radio background to black.
236 | gigaByte.setForeground(Color.white); // Sets gigaByte radio text to white.
237 |
238 | radioList.setBackground(Color.black); // Sets JPanel radioList background to black.
239 |
240 | butty.setBackground(Color.black); // Sets JPanel butty background to black.
241 | butty.requestFocusInWindow(); // Sets focus on button to avoid focus on textField, because it will include "Choose a file..." if user types without clicking the textField.
242 | buttonPump.setFont(new Font("Arial", Font.BOLD, 13)); // Changes buttonPump font to Arial, Bold, and to size 13.
243 |
244 | buttonPump.setBackground(Color.gray); // Sets button background color to gray. (Contrasting colors)
245 | buttonPump.setForeground(Color.white); // Sets button text color to white. (Contrasting colors)
246 |
247 | opnButt.setBackground(Color.gray); // Sets button background color to gray. (Contrasting colors)
248 | opnButt.setForeground(Color.white); // Sets button text color to white. (Contrasting colors)
249 | opnButt.setFont(new Font("Arial", Font.BOLD, 13)); // Changes opnButt font to Arial, Italic, and to size 15.
250 |
251 | buttonInfo.setBackground(Color.gray); // Sets button background color to gray. (Contrasting colors)
252 | buttonInfo.setForeground(Color.white); // Sets button text color to white. (Contrasting colors)
253 | buttonInfo.setFont(new Font("Arial", Font.BOLD, 13)); // Changes opnButt font to Arial, Italic, and to size 15.
254 |
255 | texty.setBackground(Color.black); // Sets JPanel texty background to black.
256 |
257 | textBox.setFont(new Font("Arial", Font.ITALIC, 13)); // Changes textBox font to Arial, Italic, and to size 15.
258 |
259 | valueBox.setFont(new Font("Arial", Font.ITALIC, 13)); // Changes valueBox font to Arial, Italic, and to size 15.
260 |
261 | // === *** UIManager GUI SETTINGS *** ===
262 | UIManager.put("Panel.background", Color.BLACK);
263 | UIManager.put("Button.background", Color.BLACK);
264 | UIManager.put("ComboBox.background", Color.BLACK);
265 | UIManager.put("ComboBox.foreground", Color.WHITE);
266 | UIManager.put("Button.foreground", Color.WHITE);
267 | UIManager.put("TextField.background", Color.BLACK);
268 | UIManager.put("TextField.foreground", Color.WHITE);
269 | UIManager.put("OptionPane.background", Color.BLACK);
270 | UIManager.put("OptionPane.messageForeground", Color.WHITE);
271 | UIManager.put("FileChooser.foreground", Color.white);
272 | UIManager.put("Label.foreground", Color.white);
273 | }
274 | }
275 |
--------------------------------------------------------------------------------