Skip to content

Commit fcf527e

Browse files
committed
Initial commit
0 parents  commit fcf527e

32 files changed

+925
-0
lines changed

.gitignore

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Compiled class file
2+
*.class
3+
4+
# Log file
5+
*.log
6+
7+
# BlueJ files
8+
*.ctxt
9+
10+
# Mobile Tools for Java (J2ME)
11+
.mtj.tmp/
12+
13+
# Package Files #
14+
*.jar
15+
*.war
16+
*.nar
17+
*.ear
18+
*.zip
19+
*.tar.gz
20+
*.rar
21+
22+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23+
hs_err_pid*
24+
25+
.gradle
26+
**/build/
27+
!src/**/build/
28+
29+
# Ignore Gradle GUI config
30+
gradle-app.setting
31+
32+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
33+
!gradle-wrapper.jar
34+
35+
# Cache of project
36+
.gradletasknamecache
37+
38+
# SLEIGH
39+
*.sla
40+
41+
# IDE/ant/gradle
42+
.settings
43+
.ant*
44+
.gradle
45+
.project
46+
.classpath

Module.manifest

Whitespace-only changes.

bin/README.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Java source directory to hold module-specific Ghidra scripts.

bin/help/TOC_Source.xml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version='1.0' encoding='ISO-8859-1' ?>
2+
<!--
3+
4+
This is an XML file intended to be parsed by the Ghidra help system. It is loosely based
5+
upon the JavaHelp table of contents document format. The Ghidra help system uses a
6+
TOC_Source.xml file to allow a module with help to define how its contents appear in the
7+
Ghidra help viewer's table of contents. The main document (in the Base module)
8+
defines a basic structure for the
9+
Ghidra table of contents system. Other TOC_Source.xml files may use this structure to insert
10+
their files directly into this structure (and optionally define a substructure).
11+
12+
13+
In this document, a tag can be either a <tocdef> or a <tocref>. The former is a definition
14+
of an XML item that may have a link and may contain other <tocdef> and <tocref> children.
15+
<tocdef> items may be referred to in other documents by using a <tocref> tag with the
16+
appropriate id attribute value. Using these two tags allows any module to define a place
17+
in the table of contents system (<tocdef>), which also provides a place for
18+
other TOC_Source.xml files to insert content (<tocref>).
19+
20+
During the help build time, all TOC_Source.xml files will be parsed and validated to ensure
21+
that all <tocref> tags point to valid <tocdef> tags. From these files will be generated
22+
<module name>_TOC.xml files, which are table of contents files written in the format
23+
desired by the JavaHelp system. Additionally, the genated files will be merged together
24+
as they are loaded by the JavaHelp system. In the end, when displaying help in the Ghidra
25+
help GUI, there will be on table of contents that has been created from the definitions in
26+
all of the modules' TOC_Source.xml files.
27+
28+
29+
Tags and Attributes
30+
31+
<tocdef>
32+
-id - the name of the definition (this must be unique across all TOC_Source.xml files)
33+
-text - the display text of the node, as seen in the help GUI
34+
-target** - the file to display when the node is clicked in the GUI
35+
-sortgroup - this is a string that defines where a given node should appear under a given
36+
parent. The string values will be sorted by the JavaHelp system using
37+
a javax.text.RulesBasedCollator. If this attribute is not specified, then
38+
the text of attribute will be used.
39+
40+
<tocref>
41+
-id - The id of the <tocdef> that this reference points to
42+
43+
**The URL for the target is relative and should start with 'help/topics'. This text is
44+
used by the Ghidra help system to provide a universal starting point for all links so that
45+
they can be resolved at runtime, across modules.
46+
47+
48+
-->
49+
50+
51+
<tocroot>
52+
<!-- Uncomment and adjust fields to add help topic to help system's Table of Contents
53+
<tocref id="Ghidra Functionality">
54+
<tocdef id="HelpAnchor" text="My Feature" target="help/topics/my_topic/help.html" />
55+
</tocref>
56+
-->
57+
</tocroot>

bin/help/shared/Frontpage.css

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/* ###
2+
* IP: GHIDRA
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
/*
17+
WARNING!
18+
This file is copied to all help directories. If you change this file, you must copy it
19+
to each src/main/help/help/shared directory.
20+
21+
22+
Java Help Note: JavaHelp does not accept sizes (like in 'margin-top') in anything but
23+
px (pixel) or with no type marking.
24+
25+
*/
26+
27+
body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 10px; } /* some padding to improve readability */
28+
li { font-family:times new roman; font-size:14pt; }
29+
h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
30+
h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
31+
h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; }
32+
h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
33+
34+
/*
35+
P tag code. Most of the help files nest P tags inside of blockquote tags (the was the
36+
way it had been done in the beginning). The net effect is that the text is indented. In
37+
modern HTML we would use CSS to do this. We need to support the Ghidra P tags, nested in
38+
blockquote tags, as well as naked P tags. The following two lines accomplish this. Note
39+
that the 'blockquote p' definition will inherit from the first 'p' definition.
40+
*/
41+
p { margin-left: 40px; font-family:times new roman; font-size:14pt; }
42+
blockquote p { margin-left: 10px; }
43+
44+
p.providedbyplugin { color:#7f7f7f; margin-left: 10px; font-size:14pt; margin-top:100px }
45+
p.ProvidedByPlugin { color:#7f7f7f; margin-left: 10px; font-size:14pt; margin-top:100px }
46+
p.relatedtopic { color:#800080; margin-left: 10px; font-size:14pt; }
47+
p.RelatedTopic { color:#800080; margin-left: 10px; font-size:14pt; }
48+
49+
/*
50+
We wish for a tables to have space between it and the preceding element, so that text
51+
is not too close to the top of the table. Also, nest the table a bit so that it is clear
52+
the table relates to the preceding text.
53+
*/
54+
table { margin-left: 20px; margin-top: 10px; width: 80%;}
55+
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
56+
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
57+
58+
/*
59+
Code-like formatting for things such as file system paths and proper names of classes,
60+
methods, etc. To apply this to a file path, use this syntax:
61+
<CODE CLASS="path">...</CODE>
62+
*/
63+
code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
64+
code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2+
3+
<HTML>
4+
<HEAD>
5+
<META name="generator" content=
6+
"HTML Tidy for Java (vers. 2009-12-01), see jtidy.sourceforge.net">
7+
<META http-equiv="Content-Language" content="en-us">
8+
<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
9+
<META name="GENERATOR" content="Microsoft FrontPage 4.0">
10+
<META name="ProgId" content="FrontPage.Editor.Document">
11+
12+
<TITLE>Skeleton Help File for a Module</TITLE>
13+
<LINK rel="stylesheet" type="text/css" href="../../shared/Frontpage.css">
14+
</HEAD>
15+
16+
<BODY>
17+
<H1><a name="HelpAnchor"></a>Skeleton Help File for a Module</H1>
18+
19+
<P>This is a simple skeleton help topic. For a better description of what should and should not
20+
go in here, see the "sample" Ghidra extension in the Extensions/Ghidra directory, or see your
21+
favorite help topic. In general, language modules do not have their own help topics.</P>
22+
</BODY>
23+
</HTML>

bin/images/README.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The "src/resources/images" directory is intended to hold all image/icon files used by
2+
this module.

bin/main/images/README.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The "src/resources/images" directory is intended to hold all image/icon files used by
2+
this module.

bin/test/README.test.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The "test" directory is intended to hold unit test cases. The package structure within
2+
this folder should correspond to that found in the "src" folder.

build.gradle

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/* ###
2+
* IP: GHIDRA
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
// Builds a Ghidra Extension for a given Ghidra installation.
17+
//
18+
// An absolute path to the Ghidra installation directory must be supplied either by setting the
19+
// GHIDRA_INSTALL_DIR environment variable or Gradle project property:
20+
//
21+
// > export GHIDRA_INSTALL_DIR=<Absolute path to Ghidra>
22+
// > gradle
23+
//
24+
// or
25+
//
26+
// > gradle -PGHIDRA_INSTALL_DIR=<Absolute path to Ghidra>
27+
//
28+
// Gradle should be invoked from the directory of the project to build. Please see the
29+
// application.gradle.version property in <GHIDRA_INSTALL_DIR>/Ghidra/application.properties
30+
// for the correction version of Gradle to use for the Ghidra installation you specify.
31+
32+
//----------------------START "DO NOT MODIFY" SECTION------------------------------
33+
def ghidraInstallDir
34+
35+
if (System.env.GHIDRA_INSTALL_DIR) {
36+
ghidraInstallDir = System.env.GHIDRA_INSTALL_DIR
37+
}
38+
else if (project.hasProperty("GHIDRA_INSTALL_DIR")) {
39+
ghidraInstallDir = project.getProperty("GHIDRA_INSTALL_DIR")
40+
}
41+
else {
42+
// Jacob custom fallback
43+
ghidraInstallDir = "/Applications/ghidra_10.0.1_PUBLIC"
44+
}
45+
46+
if (ghidraInstallDir) {
47+
apply from: new File(ghidraInstallDir).getCanonicalPath() + "/support/buildExtension.gradle"
48+
}
49+
else {
50+
throw new GradleException("GHIDRA_INSTALL_DIR is not defined!")
51+
}
52+
//----------------------END "DO NOT MODIFY" SECTION-------------------------------

data/README.txt

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
The "data" directory is intended to hold data files that will be used by this module and will
2+
not end up in the .jar file, but will be present in the zip or tar file. Typically, data
3+
files are placed here rather than in the resources directory if the user may need to edit them.
4+
5+
An optional data/languages directory can exist for the purpose of containing various Sleigh language
6+
specification files and importer opinion files.
7+
8+
The data/buildLanguage.xml is used for building the contents of the data/languages directory.
9+
10+
The skel language definition has been commented-out within the skel.ldefs file so that the
11+
skeleton language does not show-up within Ghidra.
12+
13+
See the Sleigh language documentation (docs/languages/index.html) for details Sleigh language
14+
specification syntax.
15+

data/buildLanguage.xml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
+ Compile sleigh languages within this module.
5+
+ Sleigh compiler options are read from the sleighArgs.txt file.
6+
+ Eclipse: right-click on this file and choose menu item "Run As->Ant Build"
7+
-->
8+
9+
<project name="privateBuildDeveloper" default="sleighCompile">
10+
11+
<property name="sleigh.compile.class" value="ghidra.pcodeCPort.slgh_compile.SleighCompile"/>
12+
13+
<!--Import optional ant properties. GhidraDev Eclipse plugin produces this so this file can find the Ghidra installation-->
14+
<import file="../.antProperties.xml" optional="false" />
15+
16+
<target name="sleighCompile">
17+
18+
<!-- If language module is detached from installation, get Ghidra installation directory path from imported properties -->
19+
<property name="framework.path" value="${ghidra.install.dir}/Ghidra/Framework"/>
20+
21+
<path id="sleigh.class.path">
22+
<fileset dir="${framework.path}/SoftwareModeling/lib">
23+
<include name="*.jar"/>
24+
</fileset>
25+
<fileset dir="${framework.path}/Generic/lib">
26+
<include name="*.jar"/>
27+
</fileset>
28+
<fileset dir="${framework.path}/Utility/lib">
29+
<include name="*.jar"/>
30+
</fileset>
31+
</path>
32+
33+
<available classname="${sleigh.compile.class}" classpathref="sleigh.class.path" property="sleigh.compile.exists"/>
34+
35+
<fail unless="sleigh.compile.exists" />
36+
37+
<java classname="${sleigh.compile.class}"
38+
classpathref="sleigh.class.path"
39+
fork="true"
40+
failonerror="true">
41+
<jvmarg value="-Xmx2048M"/>
42+
<arg value="-i"/>
43+
<arg value="sleighArgs.txt"/>
44+
<arg value="-a"/>
45+
<arg value="./languages"/>
46+
</java>
47+
48+
</target>
49+
50+
</project>

data/languages/intcode.cspec

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<compiler_spec>
4+
<data_organization>
5+
<pointer_size value="8" />
6+
<long_size value="8" />
7+
</data_organization>
8+
<global>
9+
<range space="ram"/>
10+
</global>
11+
<stackpointer register="SP" space="ram"/>
12+
<default_proto>
13+
<prototype name="__asmA" extrapop="0" stackshift="0">
14+
<input />
15+
<output />
16+
</prototype>
17+
</default_proto>
18+
</compiler_spec>

data/languages/intcode.ldefs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<language_definitions>
4+
<language processor="Intcode"
5+
endian="little"
6+
size="64"
7+
variant="default"
8+
version="1.0"
9+
slafile="intcode.sla"
10+
processorspec="intcode.pspec"
11+
id="intcode:LE:64:default">
12+
<description>Intcode 64</description>
13+
<compiler name="default" spec="intcode.cspec" id="default"/>
14+
</language>
15+
</language_definitions>

data/languages/intcode.opinion

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<opinions>
2+
<constraint loader="Intcode Text" compilerSpecID="default">
3+
<constraint processor="Intcode" endian="little" size="64" />
4+
</constraint>
5+
</opinions>

data/languages/intcode.pspec

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<processor_spec>
4+
<programcounter register="PC"/>
5+
<context_data>
6+
<tracked_set space="ram" first="0" last="0">
7+
<set name="SP" val="0"/>
8+
</tracked_set>
9+
</context_data>
10+
</processor_spec>

0 commit comments

Comments
 (0)