TraCINgFormatter.java 740 B

12345678910111213141516171819202122232425
  1. package de.tudarmstadt.informatik.hostage.logging.formatter;
  2. import de.tudarmstadt.informatik.hostage.logging.Record;
  3. public class TraCINgFormatter extends Formatter {
  4. private static Formatter INSTANCE = new TraCINgFormatter();
  5. public static Formatter getInstance() {
  6. return INSTANCE;
  7. }
  8. private TraCINgFormatter() {
  9. }
  10. @Override
  11. public synchronized String format(Record record) {
  12. return String
  13. .format("{ \"sensor\":{\"type\": \"Honeypot\", \"name\": \"HosTaGe\"}, \"type\": \"%s server access\", \"src\":{\"ip\": \"%s\", \"port\": %d}, \"dst\":{\"ip\": \"%s\", \"port\": %d} }",
  14. record.getProtocol(), record.getRemoteIP(),
  15. record.getRemotePort(), record.getExternalIP(),
  16. record.getLocalPort());
  17. }
  18. }