From 9e5a01d82c3c4708e1601286cf7d08b6ce90a08d Mon Sep 17 00:00:00 2001 From: "NTEN\\Nenninger" Date: Thu, 25 Aug 2022 08:01:48 +0200 Subject: [PATCH] erste Version die funktioniert mit fast alles Funktionen --- hermineConnect.php | 357 ++++++++++++++++++++++++++++----------------- hermineConnect.zip | Bin 0 -> 5025 bytes readme.txt | 42 ++++++ 3 files changed, 267 insertions(+), 132 deletions(-) create mode 100644 hermineConnect.zip create mode 100644 readme.txt diff --git a/hermineConnect.php b/hermineConnect.php index 7bd4d95..efc9e5d 100644 --- a/hermineConnect.php +++ b/hermineConnect.php @@ -1,13 +1,34 @@ 8.1 hermine@THW PHPConnector inspiriert von https://gitlab.com/aeberhardt/stashcat-api-client - Beispiel: + curl und php >= 7.4 + + Funktionen: + + get_last_error(); + + + login(soll der Login gespeichert werden); + + get_companies_list(); -> List der Firmen (wird beim Login erstellt) + get_conversations_list(); -> List der Konversationen (wird beim Login erstellt) + get_channels_list(); -> List der Kanäle (1. Firma) (wird beim Login erstellt) + + send_message_to_conversation(id,Nachricht,optional URLs als array, optional Standort als Array); + send_message_to_channel(id,Nachricht,optional URLs als array, optional Standort als Array); + + send_message_with_file_to_conversation(id,Nachricht,Dateiinhalt (max 5MB),Dateiname in Hermine,Type Bsp:'image/jpeg',Breite Standard 0,Höhe Standard 0); + send_message_with_file_to_channel(id,Nachricht,Dateiinhalt (max 5MB),Dateiname in Hermine,Type Bsp:'image/jpeg',Breite Standard 0,Höhe Standard 0); + + get_channel_messages(id, $_limit=50, $_offset=0); -< array + get_conversation_messages(id,limit=50,offset=0); -< array + + Beispiele: $hermine = new hermineConnect('mailadresse','Accountpassword','Verschlüsselungskennwort'); if($hermine->login(true) !== false){ @@ -18,15 +39,19 @@ $array = $hermine->get_channels_list(); print_r($array); - $file = file_get_contents('./ich.jpg'); + $file = file_get_contents('./test.jpg'); $hermine->send_message_with_file_to_channel(165562,'jpg per php',$file,'test.jpg','image/jpeg',1080,2068); - send_message_to_conversation(id,message); - send_message_to_channel(id,message); + $array = $hermine->get_channel_messages(165562); + foreach($array as $msg){ + echo $msg->text."\n"; + } + + $array = $hermine->search_user('Nennin'); }else{ //login fehlgeschlagen - print_r($hermine->lasterror); + print_r($hermine->get_last_error); } */ @@ -144,7 +169,6 @@ class UUID { class hermineConnect{ private $VERSION = '1.3'; private $hermineServer = 'https://api.thw-messenger.de'; - //private $hermineServer = 'https://thw.n-tools.de'; private $connectorID = ""; private $user = ""; private $password = ""; @@ -159,31 +183,27 @@ class hermineConnect{ private $companies; private $channels; private $conversations; - //private $debug = true; + /* Hilfsfunktion für multipart/form-data; */ function build_data_files($boundary, $fields, $files){ $data = ''; $eol = "\r\n"; - $delimiter = '-------------' . $boundary; - foreach ($fields as $name => $content) { - $data .= "--" . $delimiter . $eol - . 'Content-Disposition: form-data; name="' . $name . "\"".$eol.$eol - . $content . $eol; + $data .= "--" . $delimiter . $eol + . 'Content-Disposition: form-data; name="' . $name . "\"".$eol.$eol + . $content . $eol + ; } - - foreach ($files as $name => $content) { - $data .= "--" . $delimiter . $eol - . 'Content-Disposition: form-data; name="file"; filename="[object Object]"' . $eol - . 'Content-Type: application/octet-stream'.$eol - //. 'Content-Transfer-Encoding: binary'.$eol - ; + $data .= "--" . $delimiter . $eol + . 'Content-Disposition: form-data; name="file"; filename="[object Object]"' . $eol + . 'Content-Type: application/octet-stream'.$eol + ; - $data .= $eol; - $data .= $content . $eol; + $data .= $eol; + $data .= $content . $eol; } $data .= "--" . $delimiter . "--".$eol; @@ -191,7 +211,6 @@ class hermineConnect{ return $data; } - function __construct($user,$password,$passphrase) { function intArrayToString($ia){ $ret = ''; @@ -221,8 +240,7 @@ class hermineConnect{ $boundary = uniqid(); $delimiter = '-------------' . $boundary; $_data = $this->build_data_files($boundary, $_data, $_files); - - + curl_setopt($this->cURL, CURLOPT_URL, $_url); curl_setopt($this->cURL, CURLOPT_VERBOSE, 0); curl_setopt($this->cURL, CURLOPT_SSL_VERIFYPEER, 1); @@ -248,8 +266,8 @@ class hermineConnect{ $data = curl_exec($this->cURL); if(!curl_errno($this->cURL)){ if(isset($this->debug)){ - echo "\n\nretdata->:\n".print_r($data,true); echo "\n\nSendheader->:\n".print_r(curl_getinfo($this->cURL, CURLINFO_HEADER_OUT),true); + echo "\n\nretdata->:\n".print_r($data,true); } $data = json_decode($data); if($data->status->value === "OK"){ @@ -266,7 +284,7 @@ class hermineConnect{ } - + function _open_private_key(){ $data = []; $response = $this->request($this->hermineServer."/security/get_private_key",$data); @@ -279,7 +297,7 @@ class hermineConnect{ return false; } } - + function _get_conversation_key($_target){ if($_target[0]=='conversation'){ if(!isset($this->key_cache_conversations[$_target[1]])){ @@ -307,64 +325,21 @@ class hermineConnect{ return false; } } - + function _encrypt_aes($_plain, $_key, $_iv){ $ret = openssl_encrypt($_plain, "AES-256-CBC", $_key, 0, $_iv); - print_r($ret); return $ret; } - public function getLastError(){ - return $this->lasterror; + function _decrypt_aes($_crypt, $_key, $_iv){ + if(strlen($_crypt) == 0) + return '[Dieser Inhalt wurde gelöscht.]'; + $ret = openssl_decrypt($_crypt, "AES-256-CBC", $_key, 0, $_iv); + if($ret === false) + return '[!!ERROR DeCrypt] -> '.openssl_error_string(); + return $ret; } - public function getID(){ - return $this->connectorID; - } - - public function login($_saveLogin=false){ - if($_saveLogin){ - if(file_exists('./login.dat')){ - $savelogin = json_decode(file_get_contents('./login.dat')); - $this->client_key = $savelogin->ClientKey; - $this->connectorID = $savelogin->DeviceId; - $this->user_id = $savelogin->UserID; - if($this->_open_private_key()){ - $this->companies = $this->get_companies(); - $this->channels = $this->get_channels($this->companies->companies[0]->id); - $this->conversations = $this->get_conversations(); - return true; - } - } - } - $data = [ - "email" => $this->user, - "password" => $this->password, - "app_name" => 'hermine@thw-PHP:'.$this->VERSION, - "encrypted" => true, - "callable" => false - ]; - - $response = $this->request($this->hermineServer."/auth/login",$data); - if($response !== false){ - $this->client_key = $response->client_key; - $this->user_id = $response->userinfo->id; - if($this->_open_private_key()){ - $this->companies = $this->get_companies(); - $this->channels = $this->get_channels($this->companies->companies[0]->id); - $this->conversations = $this->get_conversations(); - if($_saveLogin){ - $savelogin['ClientKey'] = $this->client_key; - $savelogin['DeviceId'] = $this->connectorID; - $savelogin['UserID'] = $this->user_id; - file_put_contents('./login.dat',json_encode($savelogin)); - } - return true; - } - } - return false; - } - function get_companies(){ $data = [ "no_cache" => true @@ -407,31 +382,7 @@ class hermineConnect{ } } - public function get_companies_list(){ - $ret = []; - foreach($this->companies->companies as $company){ - $ret[$company->id] = $company->name; - } - return $ret; - } - - public function get_conversations_list(){ - $ret = []; - foreach($this->conversations->conversations as $conversation){ - $ret[$conversation->id] = $conversation->members[0]->last_name; - } - return $ret; - } - - public function get_channels_list(){ - $ret = []; - foreach($this->channels->channels as $channels){ - $ret[$channels->id] = $channels->name; - } - return $ret; - } - - function sendmsg($_target,$_message,$_files=[],$_location=false,$_encrypted=true){ + function sendmsg($_target,$_message,$_files=[],$_url=[],$_location=NULL){ $iv = openssl_random_pseudo_bytes(16); $conversation_key = $this->_get_conversation_key($_target); $data = [ @@ -440,24 +391,16 @@ class hermineConnect{ "text" => bin2hex(base64_decode($this->_encrypt_aes($_message, $conversation_key, $iv))), "iv" => bin2hex($iv), "files" => json_encode($_files), //Nummern vom Upload! - "url" => "[]", + "url" => json_encode($_url), "type" => "text", "verification" => "", "encrypted" => true ]; - if(!$_encrypted){ - $data['encrypted'] = false; - $data['text'] = $_message; - unset($data[$iv]); - } - - if($_location !== false){ - if(!$_encrypted){ - - } - } - print_r($data); + if(!is_null($_location)){ + $data["latitude"] = bin2hex(base64_decode($this->_encrypt_aes(strval($_location[0]), $conversation_key, $iv))); + $data["longitude"] = bin2hex(base64_decode($this->_encrypt_aes(strval($_location[1]), $conversation_key, $iv))); + } $response = $this->request($this->hermineServer."/message/send",$data); if($response !== false){ return $response; @@ -466,24 +409,14 @@ class hermineConnect{ } } - //function uploadfile($_target,$_filerawdatat,$_filename,$_content_type="application/octet-stream",$_media_size=NULL,$_encrypted=false){ function uploadfile($_target,$_fileraw,$_filename,$_filetype,$_mediawidth=0,$_mediaheight=0){ $iv = openssl_random_pseudo_bytes(16); $file_key = openssl_random_pseudo_bytes(32); - - //$file = file_get_contents($_filewithpath); - $file_uuid = UUID::v4(); - $chunk_size = 5 * 1024 * 1024; $filesize = strlen($_fileraw); - - //$file = new \CURLStringFile($_fileraw, $_filename, $_filetype); - $file_encryptet = base64_decode($this->_encrypt_aes($_fileraw, $file_key, $iv)); - $file = ['dummy' => $file_encryptet]; - $data = [ "resumableChunkNumber" => 0, "resumableChunkSize" => $chunk_size, @@ -522,8 +455,138 @@ class hermineConnect{ } } - public function send_message_to_conversation($_conversation_id,$_message){ - return $this->sendmsg(array('conversation',$_conversation_id),$_message); + function get_messages($_source, $_limit=30, $_offset=0){ + $conversation_key = $this->_get_conversation_key($_source); + $data = [ + $_source[0]."_id" => $_source[1], + "source" => $_source[0], + "limit" => $_limit, + "offset" => $_offset, + ]; + + $response = $this->request($this->hermineServer."/message/content",$data); + $ret = []; + if($response !== false){ + foreach($response->messages as $message){ + if($message->kind == "message"){ + if($message->encrypted){ + $encryptet = $this->_decrypt_aes(base64_encode(hex2bin($message->text)), $conversation_key, hex2bin($message->iv)); + if($encryptet !== false) + $message->text = $encryptet; + else + $message->text = '[!!decrypterror!!]'; + } + if($message->location->encrypted){ + $encryptet = $this->_decrypt_aes(base64_encode(hex2bin($message->location->latitude)), $conversation_key, hex2bin($message->location->iv)); + if($encryptet !== false) + $message->location->latitude = $encryptet; + else + $message->location->latitude = '[!!decrypterror!!]'; + $encryptet = $this->_decrypt_aes(base64_encode(hex2bin($message->location->longitude)), $conversation_key, hex2bin($message->location->iv)); + if($encryptet !== false) + $message->location->longitude = $encryptet; + else + $message->location->longitude = '[!!decrypterror!!]'; + } + $ret[] = $message; + } + } + return $ret; + }else{ + return false; + } + } + +/* + Öffentliche Funktionen +*/ + + /* + Ausgabe Fehlermeldung von Hermine + */ + public function get_last_error(){ + return $this->lasterror; + } + + /* + Ausgabe der ID (wird aus eigenem Servername ermittelt) + */ + public function get_connector_id(){ + return $this->connectorID; + } + + /* + Login, wenn $_saveLogin=true, dann wird device_id und client_key in login.dat gespeichert und es erfolgt keine Mitteilung in Hermine + */ + public function login($_saveLogin=false){ + if($_saveLogin){ + if(file_exists('./login.dat')){ + $savelogin = json_decode(file_get_contents('./login.dat')); + $this->client_key = $savelogin->ClientKey; + $this->connectorID = $savelogin->DeviceId; + $this->user_id = $savelogin->UserID; + if($this->_open_private_key()){ + $this->companies = $this->get_companies(); + $this->channels = $this->get_channels($this->companies->companies[0]->id); + $this->conversations = $this->get_conversations(); + return true; + } + } + } + $data = [ + "email" => $this->user, + "password" => $this->password, + "app_name" => 'hermine@thw-PHP:'.$this->VERSION, + "encrypted" => true, + "callable" => false + ]; + + $response = $this->request($this->hermineServer."/auth/login",$data); + if($response !== false){ + $this->client_key = $response->client_key; + $this->user_id = $response->userinfo->id; + if($this->_open_private_key()){ + $this->companies = $this->get_companies(); + $this->channels = $this->get_channels($this->companies->companies[0]->id); + $this->conversations = $this->get_conversations(); + if($_saveLogin){ + $savelogin['ClientKey'] = $this->client_key; + $savelogin['DeviceId'] = $this->connectorID; + $savelogin['UserID'] = $this->user_id; + file_put_contents('./login.dat',json_encode($savelogin)); + } + return true; + } + } + return false; + } + + public function get_companies_list(){ + $ret = []; + foreach($this->companies->companies as $company){ + $ret[$company->id] = $company->name; + } + return $ret; + } + + public function get_conversations_list(){ + $ret = []; + foreach($this->conversations->conversations as $conversation){ + $ret[$conversation->id] = $conversation->members[0]->first_name.' '.$conversation->members[0]->last_name; + } + return $ret; + } + + public function get_channels_list(){ + $ret = []; + foreach($this->channels->channels as $channels){ + $ret[$channels->id] = $channels->name; + } + return $ret; + } + + public function send_message_to_conversation($_conversation_id,$_message,$_url=[],$_location=NULL){ + return $this->sendmsg(array('conversation',$_conversation_id),$_message,[],$_url,$_location); } public function send_message_with_file_to_conversation($_conversation_id,$_message,$_fileraw,$_filename,$_filetype,$_mediawidth=0,$_mediaheight=0){ @@ -531,14 +594,44 @@ class hermineConnect{ return $this->sendmsg(array('conversation',$_conversation_id),$_message,[$ret]); } - public function send_message_to_channel($_channel_id,$_message){ - return $this->sendmsg(array('channel',$_channel_id),$_message); + public function send_message_to_channel($_channel_id,$_message,$_url=[],$_location=NULL){ + return $this->sendmsg(array('channel',$_channel_id),$_message,[],$_url,$_location); } public function send_message_with_file_to_channel($_channel_id,$_message,$_fileraw,$_filename,$_filetype,$_mediawidth=0,$_mediaheight=0){ $ret = $this->uploadfile(array('channel',$_channel_id),$_fileraw,$_filename,$_filetype,$_mediawidth,$_mediaheight); return $this->sendmsg(array('channel',$_channel_id),$_message,[$ret]); } + + public function get_conversation_messages($_conversation_id, $_limit=30, $_offset=0){ + return $this->get_messages(array('conversation',$_conversation_id),$_limit,$_offset); + } + + public function get_channel_messages($_channel_id){ + return $this->get_messages(array('channel',$_channel_id),$_limit,$_offset); + } + + public function search_user($_searchby, $_limit=50, $_offset=0){ + $data = [ + "limit" => $_limit, + "offset" => $_offset, + "key_hashes" => false, + "search" => $_searchby, + "sorting" => ["first_name_asc", "last_name_asc"], + "exclude_user_ids" => [], + "group_ids" => [], + ]; + + $response = $this->request($this->hermineServer."/users/listing",$data); + if($response !== false){ + return $response->users; + }else{ + return false; + } + } + + + } ?> diff --git a/hermineConnect.zip b/hermineConnect.zip new file mode 100644 index 0000000000000000000000000000000000000000..dce72b7b74597e350878d40856caea61cc210667 GIT binary patch literal 5025 zcmZ{oWl$7=v%v4@7U_nQkS<9XiA{PbKt9bLj(ZuYXJcN0I;@jaj=0|NISw{ z7G|#8PS#E*G%GGg0_T*Lx0snq-Pj_{St$?*PT@%)*hb9Z1)fIKAT&v4W3fB60sWrZ z2e{rv?D$C0_FV^_X@}iRIb&lAX)B+zZEVvU_InQg?ew@@9wM+F;&}UQhSz*EU|^@g zk5pD_=0HvD5K|G86mlk4#tAH1f`kP37!Y9)$QhI?y}@hIa?I*lQ?8{6!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ZG!m9B%k2pgy!IwQV*3qW87^M4=@!G_>S|Q~CznI@1cFz<; zm%YkitDu9;{&0>zRs%)YU|7Vg+s#T(@;lL~E!x}CH6WtWw8~}8warLbw+eJ4Vs+W4 zp|$&0$7vtF?q(0B)oFrmjM=n)hUp=lbU|tWIy=w<^emrx;+bf?W#MLH1{W% zIsLBd%{SIj7{qUIv?-O(dZd>Vf`;f_$S3O#^KV*TbN(Plx%H9d(_OxqPur)&`@=iz z$7-CrVTB#|DJ9HRCM0!ZAC{OeP(Md_Cm|dtA&uGFPQCH zZ|sgL#KGtV(%fg;MwIgJg;WFlu?z2{pbs^ccNHN?Qh`n#qInMHCX?pPA%()2g7D-M z?kOQ25N~f|k7iksAyxqwPPBhF>a6k}Sdbi8b%NABfO~6AmSyUXb|~3bJ^Xo^#8KDD!q13YK24VgKDg9JZNv&Q zI+T>V*(T&f*pH5Osyjx}-pMxatZY{fZr)!R=>6lh4=}(lMisf>$Q*S5RiB!WknI9ocaZEW%dL;O zU%yuLRPxpcqpqM}C{B>S(_J^6(IZe50z{Dj{C}d1>7Oe5PcZy<{lBys&i~AS0180W kQN-~;^&;?pIVsu@##X-g?*=-?e-;4$rTIU;CjL+NUmjMjng9R* literal 0 HcmV?d00001 diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..5354f7b --- /dev/null +++ b/readme.txt @@ -0,0 +1,42 @@ +Nenninger N-Tools.de + Version 1.5 + + hermine@THW PHPConnector + inspiriert von https://gitlab.com/aeberhardt/stashcat-api-client + + curl und php >= 7.4 + + Funktionen: + + get_last_error(); + + + login(soll der Login gespeichert werden); + + get_companies_list(); -> List De Firmen (wird beim Login erstellt) + + send_message_to_conversation(id,Nachricht,optional URLs als array, optional Standort als Array); + send_message_to_channel(id,Nachricht,optional URLs als array, optional Standort als Array); + + send_message_with_file_to_channel(id,Nachricht,Dateiinhalt (max 5MB),Dateiname in Hermine,Type Bsp:'image/jpeg',Breite Standard 0,Höhe Standard 0); + + Beispiele: + + $hermine = new hermineConnect('mailadresse','Accountpassword','Verschlüsselungskennwort'); + if($hermine->login(true) !== false){ + $array = $hermine->get_companies_list(); + print_r($array); + $array = $hermine->get_conversations_list(); + print_r($array); + $array = $hermine->get_channels_list(); + print_r($array); + + $file = file_get_contents('./ich.jpg'); + $hermine->send_message_with_file_to_channel(165562,'jpg per php',$file,'test.jpg','image/jpeg',1080,2068); + + + + }else{ + //login fehlgeschlagen + print_r($hermine->get_last_error); + } \ No newline at end of file