Skip to content

Commit

Permalink
Merge pull request #1328 from proditis/master
Browse files Browse the repository at this point in the history
Discord and API Target bug fix
  • Loading branch information
proditis authored Nov 28, 2024
2 parents 68bed50 + f0d848f commit 63cd84f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 12 deletions.
2 changes: 0 additions & 2 deletions backend/components/WebhookTrigger.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ public function run()
{
if (trim($this->url)=="") return;


// init the request, set some info, send it and finally close it
$ch = curl_init($this->url);

curl_setopt($ch, CURLOPT_POST, 1);
Expand Down
2 changes: 0 additions & 2 deletions backend/modules/content/models/News.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ public function attributeLabels()
public function toDiscord()
{
if(Yii::$app->sys->discord_news_webhook!==false){
$data["avatar_url"]=sprintf("https://%s/images/appicon.png",Yii::$app->sys->offense_domain);
$data['username']='echoCTF.RED';
$data['content']=$this->body;
$client = new Webhook(['url' => Yii::$app->sys->discord_news_webhook,'data'=>json_encode($data)]);
return $client->run();
Expand Down
2 changes: 0 additions & 2 deletions backend/modules/gameplay/models/Target.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,6 @@ public function addNews()
if(Yii::$app->sys->discord_news_webhook!==false)
{
$bodyPlain.="\n\nWe hope you enjoy and as always Happy Hacking :heart:";
$data["avatar_url"]=sprintf("https://%s/images/appicon.png",Yii::$app->sys->offense_domain);
$data['username']='echoCTF.RED';
$data['content']=$bodyPlain;
$client = new Webhook(['url' => Yii::$app->sys->discord_news_webhook,'data'=>json_encode($data)]);
$client->run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ public function addNews()
}
if(Yii::$app->sys->discord_news_webhook!==false)
{
$data["avatar_url"]=sprintf("https://%s/images/appicon.png",Yii::$app->sys->offense_domain);
$data['username']='echoCTF.RED';
$data['content']=$bodyPlain;
$client = new Webhook(['url' => Yii::$app->sys->discord_news_webhook,'data'=>json_encode($data)]);
$client->run();
Expand Down
9 changes: 5 additions & 4 deletions frontend/modules/api/models/Target.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ public function afterFind()
if (Yii::$app->user->identity->instance)
$this->ip = long2ip(Yii::$app->user->identity->instance->ip);
else if($this->ondemand && $this->ondemand->state==1)
{
$this->ip = long2ip($this->ip);
}
else if($this->ondemand && $this->ondemand->state!=1)
$this->ip = long2ip(0);
else
$this->ip=0;
}
$this->ip=long2ip($this->ip);
}

}

0 comments on commit 63cd84f

Please sign in to comment.