MCPcopy Create free account
hub / github.com/ReversecLabs/C3 / ReAddRemoteAgent

Method ReAddRemoteAgent

Src/Core/Profiler.cpp:1148–1168  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

1146
1147////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1148FSecure::C3::Core::Profiler::Agent* FSecure::C3::Core::Profiler::Gateway::ReAddRemoteAgent(RouteId childRouteId, BuildId buildId, FSecure::Crypto::PublicKey encryptionKey, RouteId ridOfConectionPlace, HashT childGrcHash, int32_t firstSeen, int32_t lastSeen, HostInfo hostInfo)
1149{
1150 // add agent
1151 auto newAgent = ReAddAgent(childRouteId.GetAgentId(), buildId, encryptionKey, false, firstSeen, lastSeen, std::move(hostInfo)); // TODO check if is banned
1152
1153 // add routes
1154 Relay* current = this;
1155 while (current->m_Id != ridOfConectionPlace.GetAgentId())
1156 {
1157 DeviceId outDevice = current->FindDirectionDevice(ridOfConectionPlace.GetAgentId());
1158 current->ReAddRoute(childRouteId, outDevice, false);
1159 current = FindNeighborOnDevice(*current, outDevice);
1160 }
1161
1162 // add route to neighboring device
1163 current->ReAddRoute(childRouteId, ridOfConectionPlace.GetInterfaceId(), true);
1164
1165 // add return channel to new agent
1166 newAgent->ReAddChannel(childRouteId.GetInterfaceId(), childGrcHash, true);
1167 return newAgent;
1168}
1169
1170////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1171void FSecure::C3::Core::Profiler::Relay::UpdateFromNegotiationChannel(DeviceId negotiationDid, DeviceId newDeviceId, std::string newInputId, std::string newOutputId)

Callers 1

OnMethod · 0.80

Calls 5

FindDirectionDeviceMethod · 0.80
ReAddRouteMethod · 0.80
GetInterfaceIdMethod · 0.80
ReAddChannelMethod · 0.80
GetAgentIdMethod · 0.45

Tested by

no test coverage detected