Skip to content

Commit

Permalink
feat(log-writer): prod json 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
inferior3x committed Nov 28, 2024
1 parent 5af0583 commit 25a76f5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@Component
public class NetworkConfig {
// Getters and setters
private final Map<String, String> interfaceInfo; //k: name, v: ssid
private final Map<String, String> ssidInfo; //k: name, v: ssid
private final Monitor monitor;
private final List<Managed> mdnsList;
private final List<Managed> arpList;
Expand All @@ -29,9 +29,8 @@ public NetworkConfig(@Value("${spring.profiles.active:default}") String profile,
Map<String, Object> map = mapper.readValue(resource.getFile(), Map.class);

//interface_info
List<Map<String, String>> interfaceInfoList = (List<Map<String, String>>) map.get(
"interface_info");
this.interfaceInfo = interfaceInfoList.stream()
List<Map<String, String>> interfaceInfoList = (List<Map<String, String>>) map.get("ssid_info");
this.ssidInfo = interfaceInfoList.stream()
.collect(Collectors.toMap(info-> info.get("name"), info->info.get("ssid")));

//monitor
Expand All @@ -48,14 +47,14 @@ public NetworkConfig(@Value("${spring.profiles.active:default}") String profile,
Map<String, Object> mdnsMap = (Map<String, Object>) managedMap.get("mdns");
String mdnsCommand = (String) mdnsMap.get("command");
this.mdnsList = ((List<String>) mdnsMap.get("interfaces")).stream()
.map(interfaceName->new Managed(interfaceName, interfaceInfo.get(interfaceName), generateCommand(mdnsCommand, interfaceName)))
.map(interfaceName->new Managed(interfaceName, ssidInfo.get(interfaceName), generateCommand(mdnsCommand, interfaceName)))
.toList();

// arp
Map<String, Object> arpMap = (Map<String, Object>) managedMap.get("arp");
String arpCommand = (String) arpMap.get("command");
this.arpList = ((List<String>) arpMap.get("interfaces")).stream()
.map(interfaceName->new Managed(interfaceName, interfaceInfo.get(interfaceName), generateCommand(arpCommand, interfaceName)))
.map(interfaceName->new Managed(interfaceName, ssidInfo.get(interfaceName), generateCommand(arpCommand, interfaceName)))
.toList();

} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"interface_info": [
"ssid_info": [
{
"name": "en0",
"ssid": "*"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
{
"interface_info": [
"ssid_info": [
{
"name": "en0",
"ssid": "*"
"name": "default_wlan",
"ssid": "JNU"
},
{
"name": "usb_wlan0",
"ssid": "eduroam"
},
{
"name": "usb_wlan1",
"ssid": "ECONO_5G"
}
],

"monitor": {
"command": "tshark -l -i {{interface}} -T fields -e wlan.sa -e eth.src",
"interface": "en0"
"interface": "monitor_wlan"
},

"managed": {
"mdns": {
"command": "sudo -S tshark -l -i {{interface}} -Y mdns -T fields -e eth.src -e ip.src -e dns.ptr.domain_name",
"interfaces": ["en0"]
"interfaces": ["default_wlan", "usb_wlan0"]
},
"arp": {
"command": "sudo -S arp-scan --interface={{interface}} --localnet",
"interfaces": ["en0"]
"interfaces": ["usb_wlan1"]
}
}
}

0 comments on commit 25a76f5

Please sign in to comment.