Osemu Operation

dale_para_bajo

Registered
Messages
646
You all guy know I do not own an Enigma2 box. So my knowledge of how it works is very limited. I do use Osemu as a source code for encryption protocols.

But I am interested in the process not how to set up or config files. Please note that I am asking for help not trying to say what it is.

For example in PowerVu Stream Relay.
Here is what I assume is going in but PLEASE correct me if I am wrong.

A-Installation process
1-A Linux Box is upgraded with a Particular E2-Enigma2 OS.
2-I assume that the E2 already include Oscam.
3-I assume the Osemu is then Install manually and its config setups.

B-Decryption process.
1-User Tune a Channel
2-E2 ensure that complete transponder for the channel selected is sent to Oscam
3-Oscam see that channel is encrypted with for example Powervu.
4-Oscam normally check in it configuration and may send thru socket conection ECM+EMM to Osemu for decryption an to obtaining CW.
5-In case of PowerVu Stream Rellay version, Oscam also send ( I guess complete transponder) to Osemu on a different socket connection .
6- Osemu then do the actual DES decryption of Video and Audio Pids. And return unencrypted PIds.

Can any one with the knowledge help me if I am correct?

I am particular interested if in fact Oscam send the complete transponder data to Osemu.
Is this is correct then we could ask for a Mod of Osemu to process let say T2MI transponder Data and return unpacked video.

What is wrong with this assumption?

Any one can help with comments. But to @kebien please give me a hand on this. I know you have the knowledge to correct me Please.
 
Last edited:

xosef1234

Registered
Messages
107
Just want to inform, that T2-MI is already working on E2:
_https://www.xxxxxxx/threads/t2-mi-reception-on-e2-stb-with-sdg-image-a-complete-step-by-step-guide.170042/
 
Last edited by a moderator:

kebien

Registered
Messages
1,329
Enigma2 uses DVBAPI 3 configuration,so command set is online.
_https://www.linuxtv.org/docs/dvbapi/dvbapi.html
E2 does not include Oscam,as it doesn't include any decription elements,some images built by groups or individuals include emulators,some include a way to install it from a server,some don't have even this option and must be installed as IPK or manually.

And no,only ECM/EMM is sent to Oscam,not the whole trasponder.It finds CW and deliver them to the CA device of the box.It uses the CSA/DES decrypt module in chipset.
Demux is delivered by tuner and then handled by E2,then Oscam parse tables and reads CAid and grab ECM/EMM for decryption.

Stream relay is a way to decrypt DES offline (and now it seems is used for T2-MI),and deliver back the decrypted video,almost in real time.
In this case,it does dump the video and audio pid into a storage in order to decrypt it,then sent back to the box.
This is in principle,the way Common Interface (CI) work,difference is here Oscam does the work of the CI module.
 
Last edited:

dale_para_bajo

Registered
Messages
646
I know some E2 are T2MI capable. As pointed out here and in the original T2MI thread. I mention T2MI because I thought it was the best example as we discussed it here in this part of the forrum. I do in fact wanted to understand the concept in Osemu as some one ask me for help in a separate issue in regards my T2MI project. Please note the project was name T2MI but do other things.

...Stream relay is a way to decrypt DES offline...

..In this case,it does dump the video and audio pid into a storage in order to decrypt it,then sent back to the box....

I guess you have not look at source code

module-emulator-stream.h
module-emulator-stream.c

Listen this was not a trick question. I know for a fact from the sources that it is not in memory but a TCP/HTML socket connection see part of code
Code:
	if(connect(streamfd, (struct sockaddr *)&cservaddr, sizeof(cservaddr)) == -1)
		{ return -1; }
	if(emu_stream_source_auth)
	{
		snprintf(http_buf, http_buf_len, "GET %s HTTP/1.1\nHost: %s:%u\n"
				"User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0\n"
				"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\n"
				"Accept-Language: en-US\n"
				"Authorization: Basic %s\n"
				"Connection: keep-alive\n\n", stream_path, emu_stream_source_host, emu_stream_source_port, emu_stream_source_auth);
	}

But that is not what I ask. What I ask is if the Complete Transponder is sent or not. From the code I can see it try to parse various part of the TS like PAT, PMT,CAT EMM, ECM, etc. In fact this is the part that poc.exe copy from Osemu.

But not having a E2 Box means I can not look at that data and learn myself if in fact those pid are all sent.

To both of you I Really THANK YOU from my hart for your answer. But I am looking into what is really available at the Stream Relay SOCKET connection used by Osemu.
 
Last edited:

kebien

Registered
Messages
1,329
Maybe is better if you start a thread by explaining the goal first.


But again,I understand what you want to learn now.
 

dray1

Donating Member
Messages
49
Is this forum you are mentioning , or team the developer of this project ( osemu ) ?
IF NOT STOP SPAMMING THIS FORUM .
 

nautilus7

VIP
Messages
607
SatDreamGr image is the first (and only I believe) image that supports T2-MI.

Better think before you speak, you clueless.
 

dale_para_bajo

Registered
Messages
646
@Kebien you are correct I should had started with main objective.

But see that it is hard to explain what code does and what a piece of new code I will like to add may look. If I start asking in code language I will confuse all just from start and I get no response. Do you see my point. I know that in this forum only a few understand how to code. And if your read 1rst post I was in the hope you have my answer. ANd it is not bad you did not have it this time. As you had help me many times in the past. I thank you. I think I will try to find joeuser he is the creator of pvu osemu patches. But He has not shown in some time.

@dray1 I wish I understand what you wrote.

I think you do not understand what is osemu and why we used it. As if you have a E2 Box chance are you are using it right now and do not know you are using it.

See OS-EMU. Something similar to OS-cam EMU-lator even when it use is more like a reader emulator. In any case it is used by OSCAM.

But Osemu has no area dedicated in this forum. I found only 1 post under Oscam.

But In particular I do not understand why you say "IF NOT STOP SPAMMING THIS FORUM"

In this forum users use many emulators to handle different cryptos. The most popular Vplug ,Oscam & Osemu. None of them are developed here but we do not claim Vplug ,Oscam or Osemu are SPAM. They are our daily tools. Hope this clear things out.

This is Funny. @kebien see dray1 is an example of how people get confuse when we speak on the code been used. As most of the people only care about "If this cracked" and "Give me Key for".

By the way more important than my previous justification is the following.

Many users are afraid to post their question. Instead of posting a question they post me a PM!! I see this as if something is wrong here!

-----------------------------
PD
While I posted another previous post shows. I still see negative responses. And to me they are useless. We are here to help each others regardless of if we are 100% correct or not. Again T2MI was use as example of similar program, I was ask to work in the future. So you guys that want to keep T2MI only for your own image can feel safe. HEHEHEHE. I will post no more responses unless is regard of what DATA is available by OSCAM in the Stream Relay TCP Port.
 
Last edited:

kebien

Registered
Messages
1,329
I think the approach to T2Ml should not start with Oscam.
E2 can deliver the pid at request and dump it would be easy,then decapsulate it too.
Es an example,the TS is available in network ports by default
In case decryption is not needed,this is the way to go.
If is encrypted,then a call to the emulator,but if the pid is not encrypted,then why use oscam at all?
 

dale_para_bajo

Registered
Messages
646
kebien I know. Again you may be correct.

If the help was ask in just Linux PC. I get data right from /dev/XXXX front end. But I was ask on a particular situation in a receiver. And I do not have an enigma box nor had ever play with it. So I got the idea that if a user is in this forum and have an E2 box it 99% of chance it has Oscam on it. And I guess %85 that it also have Osemu for PVU.

And Osemu is something I had study the code. But as you expressed the other option. Can you tell me an example of a Tuner device name use on E2 boxes?

PD. T2MI_decap is just the app I created for win7. But I used it to do all sort of decapsulation. Recently I been playing with IPTV. Just making 1 last time clear that I am not trying to have T2MI on E2.
 
Last edited:

kebien

Registered
Messages
1,329
You mean tuner as /dev/adapter0/demux0?
I believe there are 4 total in a DM800 0,1,2,3 to access,also depend on the box capability

/dev/dvb/adapter0/frontend0 for frontend.
But you know that,hard to understand what you are asking.

There should be a way to know what's available in the stream relay socket,my guess is a single channel TS : PAT,PMT,video,audios,ECM
The basics.
 
O

ooOO_SORGOS_OOoo

Code:
t2-mi

This is a commandline T2-MI baseband frame extractor. It will read a MPEG TS containing a T2-MI data stream from STDIN and output the extracted MPEG TS to STDOUT

Usage: 1)Use a tool like szap-s2 to tune a transponder 2)Find out the Data PID that contains the T2-MI stream 3) Use dvbstream and pipe to t2-mi and pipe to your video-player

For example: dvbstream -o 4096 | ./t2-mi 4096 1 | vlc -- -


Makefile

Code:
CC = g++
NAME = t2-mi
OBJECTS = t2-mi.cpp

tsniv2ni: $(OBJECTS)
	$(CC) -o $(NAME) $(OBJECTS)

t2-mi.cpp

Code:
#include<iostream>
#include<fstream>
#include<string.h>
#include<stdlib.h>

using namespace std;

istream* inbuf;
ostream* outbuf;
int size;
char* t2packet;
int t2packetsize=0;
int t2packetpos=0;
bool active=false;
char* syncB;
bool first=true;
int pad=0;
char plpId=0;
int dnp=0;


void processt2(char* buf, int len, bool isStarting) {
	//std::cerr<< "len" << len << "starting:" << isStarting << std::endl;
	if(isStarting) {
		unsigned int offset=1;
		offset+=static_cast<unsigned char>(buf[0]);
		std::cerr << "offset " << offset << std::endl;
			fprintf(stderr, "packetspos:%i\n",t2packetpos);
		if(active) {
			if(offset>1) {// && (t2packetpos + offset -1 <= t2packetsize + 10 +  pad))  //4 bytes crc
				memcpy(&t2packet[t2packetpos],&buf[1],offset-1);
				//std::cerr << "HERE" << std::endl;
				//std::cerr << "pos: " << dec << t2packetpos << " len: " << (offset-1) << " size: " << t2packetsize << std::endl;
	//			if(t2packetpos+offset-1 >t2packetsize +4) std::cerr << "ERROR" << std::endl;
			}
			fprintf(stderr,"plpId:%02x\n",t2packet[7]);
			if(t2packet[7]==plpId) {
				fprintf(stderr,"%02x %02x<>\n",static_cast<unsigned char>(t2packet[9]),static_cast<unsigned char>(t2packet[10]));
				int syncd = (unsigned char) t2packet[16];
				syncd<<=8;
				syncd |= (unsigned char) (t2packet[17]);
				syncd ****= 3;
				int upl = (unsigned char) t2packet[13];
				upl <<=8;
				upl |= (unsigned char) (t2packet[14]);
				upl ****= 3;
				upl+=19;
				if(t2packet[9]&0x4) dnp=1;
				//if(upl>t2packetsize) upl=t2packetsize;
				//std::cerr << "UPL " << hex << upl << "  " <<  hex << t2packetsize << std::endl;
				if(syncd==0xFFFF ) {
					std::cerr << "SYNC" << std::endl;
					if(upl >19)
						outbuf->write(&t2packet[19],upl-19);
				}
				else {
					if(!first && syncd>0)
					outbuf->write(&t2packet[19],syncd-dnp);
					first=false;
					int j=19+syncd;
					for(; j< upl - 187; j+=(187+dnp)) {
						outbuf->write(syncB,1);
						outbuf->write(&t2packet[j],187);
					}
					if(j< upl )  {
						outbuf->write(syncB,1);
						outbuf->write(&t2packet[j],upl -j);
					}	
				}
			}
			active=false;
		}
		//std::cerr << "pointer " << hex << (int) (unsigned char)buf[13];
		//std::cerr << "pointer " << hex << (int) (unsigned char)buf[14];
		//std::cerr << "pointer " << hex << (int) (unsigned char)buf[15] << std::endl;
		fprintf(stderr, "art: ");
		for(int k=0;k<128;k++)
		fprintf(stderr, "%02x ",(unsigned char)buf[offset+k]);
		fprintf(stderr, "\n");
		
		if((buf[offset])==0x0) { //Baseband Frame
			t2packetsize= (unsigned char) buf[offset+4];
			t2packetsize<<=8;
			t2packetsize|= (unsigned char) (buf[offset+5]);
			//std::cerr << hex << (int) static_cast<unsigned char>(buf[offset+4]) << std::endl;
			//std::cerr << hex <<  (int) static_cast<unsigned char>(buf[offset+5]) << std::endl;
			//std::cerr << "p-size: " << hex << t2packetsize << std::endl;
			if(t2packetsize&0x07 !=0x00) {
			t2packetsize****=3;
			t2packetsize+=6;
			pad=1;
			} else {
			t2packetsize****=3;
			t2packetsize+=6;
			pad=0;
			}
			//if( (len - offset) >0 && t2packetsize >= 6) {
			if( (len - offset) >0) {
				memcpy(t2packet,&buf[offset],len-offset);
				t2packetpos=len-offset;
				active=true;
			}
		}
	} else if(active) {// && (t2packetpos+len <= t2packetsize + 10 + pad)) 
		//std::cerr << "pos: " << dec << t2packetpos << " len: " << len << " size: " << t2packetsize << std::endl;
		memcpy(t2packet+t2packetpos,buf,len);
		t2packetpos+=len;
	}
}



int main(int argc, char** argv) {
	inbuf = &cin;
	outbuf = &cout;
	if(argc!=3) 
	{
		
		fprintf(stderr, "Usage: %s [PID] [PLP-ID]\n", argv[0]);
		return 1;
	}
	plpId=atoi(argv[2]);
	size=200;
	char* packets= new char[size*188];
	active=false;
	t2packet =new char[0x5009];
	syncB = new char[1];
	syncB[0]=0x47;
	while(1) {
		inbuf->read(packets,size * 188);
		if(inbuf->fail()) break;
		unsigned char *p;
		//outbuf->write(packets,size*188);
		for(int i=0; i<size*188;i+=188) {
				int start=0;
				/*if((((packets[i+3])&0xC0))!=0x00) {
					std::cerr << "encrypted" << std::endl;	
					continue;
				}*/
				int pid=(unsigned char)(packets[i+1]);
				pid&=0x01F;
				pid<<=8;
				pid|=(unsigned char)(packets[i+2]);
				
				if(pid!=atoi(argv[1])) {
					continue;

				}
				if((((packets[i+3])&0x30)****4)==0x03) {
					start++;
					//printf("%i<>",static_cast<unsigned char>(packet[4]));
					start+=static_cast<unsigned char>(packets[i+4]); //adaption + payload, offset addieren
					if(start> 183) {
						std::cerr << "wrong AF" << std::endl;	
						continue;
					}
				}
				else if(((((packets[i + 3])&0x30)****4)==0x02)) {
					std::cerr<< "cont " << i << std::endl;
					continue; // nur adaption field
				}
				if((((packets[i+1])&0x40)****4)==0x04) { //START INDICATOR
					processt2(&packets[i+4+start],184-start, true);
				} else {
					processt2(&packets[i+4+start],184-start, false);
				}
		}
	}
	return 0;
}

may be we can add OS EMU SOURCE
 

zayden

Registered
Messages
61
And no,only ECM/EMM is sent to Oscam,not the whole trasponder.It finds CW and deliver them to the CA device of the box.It uses the CSA/DES decrypt module in chipset.
Demux is delivered by tuner and then handled by E2,then Oscam parse tables and reads CAid and grab ECM/EMM for decryption.

Stream relay is a way to decrypt DES offline... and deliver back the decrypted video,almost in real time.
In this case,it does dump the video and audio pid into a storage in order to decrypt it,then sent back to the box.
This is in principle,the way Common Interface (CI) work,difference is here Oscam does the work of the CI module.

Trying to understand the process here as far as Stream Relay goes...

Does using a CI module to des decrypt negate the use of Stream Relay so that tuning a channel is all that is necessary ? (not creating stream links I mean) If so why can't Oscam remove that step if the host cpu has enough processing power ?

There are many obsolete cams here in NA which have DES decrypt routines built in. Slaving one of these shouldn't be that difficult if it's at all possible. In fact it shouldn't be that difficult to emulate the entire PV system on these cams, especially since the original source code was written for the same ST Micro family if I'm not mistaken.
 
Top