Issues (19)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

examples/send_message.php (3 issues)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * 发送消息.
4
 */
5
use Slince\SmartQQ\Client;
6
use Slince\SmartQQ\Message\Request\FriendMessage;
7
use Slince\SmartQQ\Message\Request\GroupMessage;
8
use Slince\SmartQQ\Message\Request\DiscussMessage;
9
use Slince\SmartQQ\Message\Content;
10
11
include __DIR__.'/bootstrap.php';
12
13
//创建smartQQ客户端
14
$smartQQ = new Client(getCredential());
15
16
$friends = $smartQQ->getFriends();
17
$groups = $smartQQ->getGroups();
18
$discusses = $smartQQ->getDiscusses();
19
//# 给好友发送消息
20
21
//1、找到好友
22
$friend = $friends->firstByAttribute('nick', '秋易');
23
//2、生成消息
24
//支持表情,使用中括号括起来即可,表情短语
25
/**
26
 * [.
27
"微笑" ,"撇嘴" ,"色" ,"发呆" ,"得意" ,"流泪" ,"害羞" ,"闭嘴" ,"睡" ,"大哭" ,"尴尬" ,"发怒" ,"调皮" ,"呲牙" ,"惊讶" ,"难过" ,"酷" ,"冷汗" ,"抓狂" ,"吐",
28
"偷笑" ,"可爱" ,"白眼" ,"傲慢" ,"饥饿" ,"困" ,"惊恐" ,"流汗" ,"憨笑" ,"大兵" ,"奋斗" ,"咒骂" ,"疑问" ,"嘘" ,"晕" ,"折磨" ,"衰" ,"骷髅" ,"敲打" ,"再见",
29
"擦汗" ,"抠鼻" ,"鼓掌" ,"糗大了" ,"坏笑" ,"左哼哼" ,"右哼哼" ,"哈欠" ,"鄙视" ,"委屈" ,"快哭了" ,"阴险" ,"亲亲" ,"吓" ,"可怜" ,"菜刀" ,"西瓜" ,"啤酒" ,"篮球" ,"乒乓",
30
"咖啡" ,"饭" ,"猪头" ,"玫瑰" ,"凋谢" ,"示爱" ,"爱心" ,"心碎" ,"蛋糕" ,"闪电" ,"炸弹" ,"刀" ,"足球" ,"瓢虫" ,"便便" ,"月亮" ,"太阳" ,"礼物" ,"拥抱" ,"强",
31
"弱" ,"握手" ,"胜利" ,"抱拳" ,"勾引" ,"拳头" ,"差劲" ,"爱你" ,"NO" ,"OK" ,"爱情" ,"飞吻" ,"跳跳" ,"发抖" ,"怄火" ,"转圈" ,"磕头" ,"回头" ,"跳绳" ,"挥手",
32
"激动", "街舞", "献吻", "左太极", "右太极", "双喜", "鞭炮", "灯笼", "发财", "K歌", "购物", "邮件", "帅", "喝彩","祈祷","爆筋","棒棒糖","喝奶","下面","香蕉",
33
"飞机","开车","左车头","车厢","右车头","多云","下雨","钞票","熊猫","灯泡","风车","闹钟","打伞","彩球","钻戒","沙发","纸巾","药","手枪","青蛙"
34
]
35
 */
36
$message = new FriendMessage($friend, new Content('[大哭]你好[左哼哼]'));
37
$result = $smartQQ->sendMessage($message);
38
printR($result ? 'Send Success' : 'Send Error');
39
40
//# 给群发送消息
41
//1、找到群
42
$group = $groups->firstByAttribute('name', 'msu');
43
//2、生成消息
44
$message = new GroupMessage($group, new Content('哈喽'));
0 ignored issues
show
$group is of type object|null, but the function expects a object<Slince\SmartQQ\Entity\Group>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
45
$result = $smartQQ->sendMessage($message);
46
printR($result ? 'Send Success' : 'Send Error');
47
48
//# 发送讨论组消息
49
//1、找到讨论组
50
$discuss = $discusses->firstByAttribute('name', '他是个少年');
51
//2、生成消息
52
$message = new DiscussMessage($discuss, '讨论组消息');
0 ignored issues
show
$discuss is of type object|null, but the function expects a object<Slince\SmartQQ\Entity\Discuss>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
53
$result = $smartQQ->sendMessage($message);
54
printR($result ? 'Send Success' : 'Send Error');
55
56
//# 给讨论组成员发消息
57
$discussMember = $smartQQ->getDiscussDetail($discuss)
0 ignored issues
show
$discuss is of type object|null, but the function expects a object<Slince\SmartQQ\Entity\Discuss>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
58
    ->getMembers()
59
    ->firstByAttribute('nick', '张三');
60
$message = new FriendMessage($discussMember, '你好');
61
$result = $smartQQ->sendMessage($message);
62
printR($result ? 'Send Success' : 'Send Error');
63
64
//# 给群成员发送消息
65
/*
66
$groupMember = $smartQQ->getGroupDetail($group)
67
    ->getMembers()
68
    ->firstByAttribute('nick', '清延°');
69
$message = new FriendMessage($discussMember,  '你好');
70
$result = $smartQQ->sendMessage($message);
71
printR($result ? 'Send Success' : 'Send Error');
72
*/