|
| 1 | +package org.csploit.msf; |
| 2 | + |
| 3 | +import java.util.ArrayList; |
| 4 | +import java.util.List; |
| 5 | + |
| 6 | +/** |
| 7 | + * The session class represents a post-exploitation, uh, session. |
| 8 | + * Sessions can be written to, read from, and interacted with. The |
| 9 | + * underlying medium on which they are backed is arbitrary. For |
| 10 | + * instance, when an exploit is provided with a command shell, |
| 11 | + * either through a network connection or locally, the session's |
| 12 | + * read and write operations end up reading from and writing to |
| 13 | + * the shell that was spawned. The session object can be seen |
| 14 | + * as a general means of interacting with various post-exploitation |
| 15 | + * payloads through a common interface that is not necessarily |
| 16 | + * tied to a network connection. |
| 17 | + */ |
| 18 | +public abstract class Session implements Offspring { |
| 19 | + private Framework framework; |
| 20 | + private int id; |
| 21 | + private String localTunnel; |
| 22 | + private String peerTunnel; |
| 23 | + private Exploit exploit; |
| 24 | + private Payload payload; |
| 25 | + private String description; |
| 26 | + private String info; |
| 27 | + private String workspace; |
| 28 | + private String sessionHost; |
| 29 | + private int sessionPort; |
| 30 | + private String targetHost; |
| 31 | + private String username; |
| 32 | + private String uuid; |
| 33 | + private List<String> routes = new ArrayList<>(); |
| 34 | + |
| 35 | + public Session(int id) { |
| 36 | + this.id = id; |
| 37 | + } |
| 38 | + |
| 39 | + public int getId() { |
| 40 | + return id; |
| 41 | + } |
| 42 | + |
| 43 | + public String getLocalTunnel() { |
| 44 | + return localTunnel; |
| 45 | + } |
| 46 | + |
| 47 | + public void setLocalTunnel(String localTunnel) { |
| 48 | + this.localTunnel = localTunnel; |
| 49 | + } |
| 50 | + |
| 51 | + public String getPeerTunnel() { |
| 52 | + return peerTunnel; |
| 53 | + } |
| 54 | + |
| 55 | + public void setPeerTunnel(String peerTunnel) { |
| 56 | + this.peerTunnel = peerTunnel; |
| 57 | + } |
| 58 | + |
| 59 | + public Exploit getExploit() { |
| 60 | + return exploit; |
| 61 | + } |
| 62 | + |
| 63 | + public void setExploit(Exploit exploit) { |
| 64 | + this.exploit = exploit; |
| 65 | + } |
| 66 | + |
| 67 | + public Payload getPayload() { |
| 68 | + return payload; |
| 69 | + } |
| 70 | + |
| 71 | + public void setPayload(Payload payload) { |
| 72 | + this.payload = payload; |
| 73 | + } |
| 74 | + |
| 75 | + public String getDescription() { |
| 76 | + return description; |
| 77 | + } |
| 78 | + |
| 79 | + public void setDescription(String description) { |
| 80 | + this.description = description; |
| 81 | + } |
| 82 | + |
| 83 | + public String getInfo() { |
| 84 | + return info; |
| 85 | + } |
| 86 | + |
| 87 | + public void setInfo(String info) { |
| 88 | + this.info = info; |
| 89 | + } |
| 90 | + |
| 91 | + public String getWorkspace() { |
| 92 | + return workspace; |
| 93 | + } |
| 94 | + |
| 95 | + public void setWorkspace(String workspace) { |
| 96 | + this.workspace = workspace; |
| 97 | + } |
| 98 | + |
| 99 | + public String getSessionHost() { |
| 100 | + return sessionHost; |
| 101 | + } |
| 102 | + |
| 103 | + public void setSessionHost(String sessionHost) { |
| 104 | + this.sessionHost = sessionHost; |
| 105 | + } |
| 106 | + |
| 107 | + public int getSessionPort() { |
| 108 | + return sessionPort; |
| 109 | + } |
| 110 | + |
| 111 | + public void setSessionPort(int sessionPort) { |
| 112 | + this.sessionPort = sessionPort; |
| 113 | + } |
| 114 | + |
| 115 | + public String getTargetHost() { |
| 116 | + return targetHost; |
| 117 | + } |
| 118 | + |
| 119 | + public void setTargetHost(String targetHost) { |
| 120 | + this.targetHost = targetHost; |
| 121 | + } |
| 122 | + |
| 123 | + public String getUsername() { |
| 124 | + return username; |
| 125 | + } |
| 126 | + |
| 127 | + public void setUsername(String username) { |
| 128 | + this.username = username; |
| 129 | + } |
| 130 | + |
| 131 | + public String getUuid() { |
| 132 | + return uuid; |
| 133 | + } |
| 134 | + |
| 135 | + public void setUuid(String uuid) { |
| 136 | + this.uuid = uuid; |
| 137 | + } |
| 138 | + |
| 139 | + @Override |
| 140 | + public boolean haveFramework() { |
| 141 | + return framework != null; |
| 142 | + } |
| 143 | + |
| 144 | + @Override |
| 145 | + public Framework getFramework() { |
| 146 | + return framework; |
| 147 | + } |
| 148 | + |
| 149 | + @Override |
| 150 | + public void setFramework(Framework framework) { |
| 151 | + this.framework = framework; |
| 152 | + } |
| 153 | + |
| 154 | + public abstract String getType(); |
| 155 | +} |
0 commit comments