-
Notifications
You must be signed in to change notification settings - Fork 5
Install_Compile
To simply install the AQL-System you must
- download the current release: here
- and unzip it
- done!
For a hello world like tutorial follow the runthrough tutorial.
Requirements:
- Java 16 or newer (tested with Oracle JDK only)
- Maven 3.8.1 or newer (required for Java 16)
To compile the AQL-System by yourself follow these steps:
- Clone the repository
- Build the Maven project by:
cd /path/to/project/AQL-System
mvn(Test might not be completely up-to-date, consider skipping: mvn -DskipTests)
Include the AQL-System as a library.
- Therefore download the current release: here
- or add it as Maven dependency:
<dependency>
<groupId>de.foellix</groupId>
<artifactId>AQL-System</artifactId>
<version>2.0.0</version>
</dependency>(Version probably must be adapted to the up-to-date one.)
The following code shows a very simple example. One AQL-Answer is parsed, edited and returned as an Java object.
import ...;
import de.foellix.aql.datastructure.Answer;
import de.foellix.aql.datastructure.Flow;
import de.foellix.aql.datastructure.handler.AnswerHandler;
public class AQLUser {
public Answer use(File aqlAnswerFile) {
// Parse an AQL-Answer
Answer answer = AnswerHandler.parseXML(aqlAnswerFile);
// Create a new flow
Flow flow = new Flow();
...
// Add it to the answer
answer.getFlows().getFlow().add(flow);
return answer;
}
}Another simple example. An AQL-System is initialized. A query is issued and the AQL-Answer produced upon is returned.
import ...;
import de.foellix.aql.datastructure.Answer;
import de.foellix.aql.system.AQLSystem;
public class AQLUser {
public Answer query(File apkFile) {
// Initialize aqlSystem
AQLSystem aqlSystem = new AQLSystem();
// Execute a query
return (Answer) aqlSystem.queryAndWait("Flows IN App('" + apkFile.getAbsolutePath() + "') ?").iterator().next();
}
}The following table hightlights some important classes that may become useful while developing with the AQL-System.
| Class | Capabilities |
|---|---|
| AQL-System, Options | The AQL-System itself and its Options |
| AnswerHandler | Parsing and dealing with AQL-Answers |
| ConfigHandler | Parsing and using configurations |
| RulesHandler | Parsing and using (transformation) rules |
| Helper | Contains, for example, all toString() methods for generated classes such as AQL-Answers |
| HashHelper | For generating hashes |
| EqualsHelper, EqualsOptions | For equals operations on generated classes such as AQL-Answers |
Along with version 1.2.0 hooks are introduced. You can execute your own code before and after a task (e.g. analysis tool or preprocessor execution) is completed:
import ...;
import de.foellix.aql.Log;
import de.foellix.aql.config.ConfigHandler;
import de.foellix.aql.config.Tool;
import de.foellix.aql.system.AQLSystem;
import de.foellix.aql.system.ITaskHook;
import de.foellix.aql.system.task.Task;
public class HookExample {
public Collection<Object> query(File appFile) {
// Initialize aqlSystem
AQLSystem aqlSystem = new AQLSystem();
// Apply hook
Tool awesomeDroid = ConfigHandler.getInstance().getToolByName("AwesomeDroid");
ITaskHook hook = new AwesomeHook();
List<ITaskHook> hooks = new ArrayList<>();
hooks.add(hook);
aqlSystem.getTaskHooksBefore().getHooks().put(awesomeDroid, hooks);
// Execute a query
return aqlSystem.queryAndWait("Flows IN App('" + appFile.getAbsolutePath() + "')");
}
private class AwesomeHook implements ITaskHook {
@Override
public void execute(Task task) {
Log.msg("Awesome!", Log.DEBUG);
}
}
}