GP-3952 Updated the script categories to simplify and reduce the number of folders.

This commit is contained in:
ghidra_blue 2025-06-13 15:00:15 +00:00
parent 7772d98143
commit 7db176b2bd
82 changed files with 885 additions and 981 deletions

View file

@ -1,13 +1,12 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -15,13 +14,12 @@
* limitations under the License.
*/
//Converts a binary file into an ascii hex file.
//@category Conversion
import ghidra.app.script.GhidraScript;
import ghidra.util.Conv;
//@category
import java.io.*;
import ghidra.app.script.GhidraScript;
import ghidra.util.Conv;
public class BinaryToAsciiScript extends GhidraScript {
@ -37,12 +35,13 @@ public class BinaryToAsciiScript extends GhidraScript {
File outAsciiFile = askFile("Select Ascii File", "Ascii File");
if (inputBinaryFile.equals(outAsciiFile)) {
popup("Input file and output file are the same. "+inputBinaryFile.getAbsolutePath());
popup("Input file and output file are the same. " + inputBinaryFile.getAbsolutePath());
return;
}
if (outAsciiFile.exists()) {
if (!askYesNo("Ascii File Already Exists", "The ascii file already exists.\nDo you want to overwrite it?")) {
if (!askYesNo("Ascii File Already Exists",
"The ascii file already exists.\nDo you want to overwrite it?")) {
return;
}
}
@ -51,7 +50,7 @@ public class BinaryToAsciiScript extends GhidraScript {
if (bytesPerLine < 1) {
popup("Invalid bytes per line quantity: " + bytesPerLine + ".\n " +
"Value must be greater than zero.");
"Value must be greater than zero.");
return;
}
@ -59,7 +58,7 @@ public class BinaryToAsciiScript extends GhidraScript {
PrintWriter out = new PrintWriter(outAsciiFile);
byte [] buffer = new byte[4096];
byte[] buffer = new byte[4096];
int bytesWritten = 0;
while (true) {
@ -73,7 +72,7 @@ public class BinaryToAsciiScript extends GhidraScript {
break;
}
for (int i = 0 ; i < nRead ; ++i) {
for (int i = 0; i < nRead; ++i) {
if (monitor.isCancelled()) {
break;
}
@ -82,7 +81,7 @@ public class BinaryToAsciiScript extends GhidraScript {
out.append('\n');
}
out.write( Conv.toHexString(buffer[i]) );
out.write(Conv.toHexString(buffer[i]));
++bytesWritten;
}