I am trying to stream Olimex A13 encoded data to RTMP server with librtmp and view it on VLC. The problem is I cannot find how to correctly wrap Cedar data to flash container... I have found this example which looks exactly what I would need, but VLC has still problems understanding it -
No suitable decoder module:
VLC does not support the audio or video format "undf". Unfortunately there is no way for you to fix this.
I tried grabbing data through rtmpdump and it appears I cannot disable audio track which VLC is trying to get from the header
Format : Flash Video
File size : 195 KiB
Duration : 1mn 27s
Overall bit rate : 1 464 Kbps
_Server : NGINX RTMP (github.com/arut/nginx-rtmp-module)
_displayWidth : 640.000
_displayHeight : 480.000
_fps : 25.000
Video
Format : AVC
Format/Info : Advanced Video Codec
Codec ID : 7
Duration : 1mn 27s
Width : 640 pixels
Height : 480 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 25.000 fps
Bit depth : 8 bits
Bits/(Pixel*Frame) : 0.191
Audio
The last line for 'Audio' is what I suspect is causing VLC to err. Moreover I am sure the video data I am trying to send is not correctly wrapped.
From what I understood looking into example is that FLV expects a general stream description which can be flagged for video and audio stream information, other examples I found (including ffmpeg ) use some magic number following onMetaData tag, but I dont think I do that by following an example from above:
STR2AVAL(av, "onMetaData");
enc = AMF_EncodeString(enc, pend, &av);
*enc++ = AMF_ECMA_ARRAY;
enc = AMF_EncodeInt32(enc, pend, 5+5+2); //5 - video 5 - audio
The dump of my rtmp header is:
sending 307 as header
00000000 02 00 0d 40 73 65 74 44 61 74 61 46 72 61 6d 65 ...#setDataFrame
00000010 02 00 0a 6f 6e 4d 65 74 61 44 61 74 61 03 00 06 ...onMetaData...
00000020 61 75 74 68 6f 72 02 00 00 00 09 63 6f 70 79 72 author.....copyr
00000030 69 67 68 74 02 00 00 00 0b 64 65 73 63 72 69 70 ight.....descrip
00000040 74 69 6f 6e 02 00 00 00 08 6b 65 79 77 6f 72 64 tion.....keyword
00000050 73 02 00 00 00 06 72 61 74 69 6e 67 02 00 00 00 s.....rating....
00000060 0a 70 72 65 73 65 74 6e 61 6d 65 02 00 06 43 75 .presetname...Cu
00000070 73 74 6f 6d 00 05 77 69 64 74 68 00 40 84 00 00 stom..width.#...
00000080 00 00 00 00 00 05 77 69 64 74 68 00 40 84 00 00 ......width.#...
00000090 00 00 00 00 00 06 68 65 69 67 68 74 00 40 7e 00 ......height.#~.
000000a0 00 00 00 00 00 00 09 66 72 61 6d 65 72 61 74 65 .......framerate
000000b0 00 40 39 00 00 00 00 00 00 00 0c 76 69 64 65 6f .#9........video
000000c0 63 6f 64 65 63 69 64 02 00 04 61 76 63 31 00 0d codecid...avc1..
000000d0 76 69 64 65 6f 64 61 74 61 72 61 74 65 00 40 96 videodatarate.#.
000000e0 e3 60 00 00 00 00 00 08 61 76 63 6c 65 76 65 6c .`......avclevel
000000f0 00 3f f0 00 00 00 00 00 00 00 0a 61 76 63 70 72 .?.........avcpr
00000100 6f 66 69 6c 65 00 40 50 80 00 00 00 00 00 00 17 ofile.#P........
00000110 76 69 64 65 6f 6b 65 79 66 72 61 6d 65 5f 66 72 videokeyframe_fr
00000120 65 71 75 65 6e 63 79 00 40 20 00 00 00 00 00 00 equency.# ......
00000130 00 00 09 ...
After that application send PSP and SPS data which I am not sure I encode correctly too:
This is what I have in my encoder application
psp struct start
00000000 34 32 30 31 66 00 00 00 00 00 5a 30 49 41 48 2b 4201f.....Z0IAH+
00000010 56 41 55 42 37 49 00 00 00 00 00 00 00 00 00 00 VAUB7I..........
00000020 00 00 00 00 00 00 00 00 61 4f 34 78 45 67 3d 3d ........aO4xEg==
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000040 00 00 00 00 00 00 ......
psp struct end
And this is what I send to RTMP server:
sending 38 as sps/pps info
00000000 17 00 00 00 00 01 42 c0 15 03 01 00 0d 67 5a 30 ......B......gZ0
00000010 49 41 48 2b 56 41 55 42 37 49 01 00 09 68 61 4f IAH+VAUB7I...haO
00000020 34 78 45 67 3d 3d 4xEg==
info frame sent
So the questions are:
How do you modify the header to explicitly state that its video only?
How does one wrap video data in NAL format and how often do you have to transmit SPS and PPS data?
Are there any online services to inspect the RTMP data to understand whats wrong with it? VLC doesnt help much...
Related
Recently I was porting dmidecode to Windows, and was looking into SMBIOS table. I thought that will be straightforward task, just remove Linux dependent stuff from dmidecode to make it compile on windows, and instead of getting SMBIOS from memory get it with GetSystemFirmwareTable('RSMB', 0, smBiosData, size1); and feed it to other functions.
But there is a problem, GetSystemFirmwareTable reports not full SMBIOS, it is truncated at the beginning and lack some values in the header, like number of structures(I have ver 2.8 other can differ). the rest of SMBIOS is the same and can be decoded by dmidecode.
Can someone explain why is that? Or am I wrong and doing it wrong(reading SMBIOS in Windows)?
The difference:
SMBIOS from Linux(small part):
5F 53 4D 5F DF 1F 02 08 9A 00 00 00 00 00 00 00 5F 44 4D 49 5F 35 A7 09 20 00 00 00 3B 00 28 00 00 1A 00 00 01 02 00 F0 03 FF 80 98 FB 7F 01 00 00 00 03 0D 05 11 FF FF 20 00 41 6D 65 72 69 63 61 6E 20 4D 65 67 61 74 72 65 6E 64 73 20 49 6E 74 65 72 6E 61 74 69 6F 6E 61 6C 2C 20 4C 4C 43 2E 00 31 2E 44 36 00 30 31 2F 31 32 2F 32 30 32 31 00 00 01 1B 01 00 01 02 03 04 57 87 C5 95 08 81 18 D9 A7 58 00 D8 61 A1 F2 74 06 05 06 4D 69 63 72 6F 2D 53 74 61 72 20 49 6E 74 65 72 6E 61 74 69 6F 6E 61 6C 20 43 6F 2E 2C 20 4C 74 64 2E
SMBIOS from Windows(small part):
00 02 08 00 A7 09 00 00 00 1A 00 00 01 02 00 F0 03 FF 80 98 FB 7F 01 00 00 00 03 0D 05 11 FF FF 20 00 41 6D 65 72 69 63 61 6E 20 4D 65 67 61 74 72 65 6E 64 73 20 49 6E 74 65 72 6E 61 74 69 6F 6E 61 6C 2C 20 4C 4C 43 2E 00 31 2E 44 36 00 30 31 2F 31 32 2F 32 30 32 31 00 00 01 1B 01 00 01 02 03 04 57 87 C5 95 08 81 18 D9 A7 58 00 D8 61 A1 F2 74 06 05 06 4D 69 63 72 6F 2D 53 74 61 72 20 49 6E 74 65 72 6E 61 74 69 6F 6E 61 6C 20 43 6F 2E 2C 20 4C 74 64 2E
UPDATE:
CryptoAuthLib solve the problem. Many thanks #zaph
I'm working on ATSHA204 security chip, where a part of work is to calculate SHA-256 alike the chip does. I'm using
CryptoAuthentication ATSHA204A Development Library 2.0.1 [from hxxp://www.atmel.com/tools/CRYPTOAUTHENTICATIONATSHA204DEVELOPMENTLIBRARY.aspx] Implemented in C.
Well, while try any data >= 64 bytes, everything works fine. But anything < 64 bytes differ with the CHIP's calculation.
Have a look below,
message:
20 4D 56 EF 56 F6 27 71
AD CF D7 07 FC BA BE 21
A8 7D 7C AF F5 54 6F ED
27 2C F9 ED 75 B3 94 C7
1C 04 02 00 EE 01 23 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
0E EA 11 36 8E 89 D2 11
07 C1 1B 64 B6 D0 34 DA
A6 DB 66 0F 14 FB DB C6
26 7D 6A 3A 62 83 47 13
digest from Atmel's algorithm:
8C E2 28 98 6A 21 A3 40
A4 42 97 CE 4C 80 70 DF
87 97 61 B3 FC CD A2 BF
8D F0 89 EE 29 B8 68 BF
And while taking something < 64 length to same implementation,
message:
11 CC 32 8B 30 ED 04 81
73 96 A9 F8 3B F7 9E 72
23 DC 05 29 3C 65 36 70
3A 03 1C E2 C2 2D 99 4E
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 16 00 00
digest from Atmel's algorithm:
40 3D DC C0 93 A6 4B A5
01 36 7D 59 EC 8C C4 59
15 20 6D 52 A7 D5 ED 40
9B 95 31 D3 49 37 F3 F8
What should add with message which less than 64 bytes to get digest alike the CHIP calculation. [unfortunately yet failed any reply from ATMEL community]
The 2006 version of the free offline Chinese sentence dictionary Jukuu contains a collection of 100,000 publicly sourced example sentences in Chinese and English in a .dll file.
The application size is about 80mb, but once installed a 500mb DLL dictionary file is created with the source text. For whatever reason the application doesn't run on my computer, and I'd like to extract all the example sentences so I can do some POS analysis on them.
Opening the 500mb .DLL file is mostly gibberish, except for some fragments of text here and there and references to other resources.
I'm wondering if there is any way I can extract the information in plain text?
The application can be downloaded here: http://www.jukuu.com/down/download.html
Thanks!
Edit: Never-mind, It looks like when viewed in HEX, the file is ordered in a way that is not conducive to sentence mining at all:
00 06 00 02 00 07 03 00 01 00 00 00 FF FE 6E 65 76 65 72 7E 73 74 61
6E 64 20 75 70 0B 00 00 80 00 00 00 00 00 00 00 00 FF FE 33 30 32
32 31 38 32 36 38 2D 00 16 00 06 00 02 00 07 03 00 01 00 00 00 FF
FE 65 78 74 72 65 6D 65 6C 79 7E 63 6C 6F 73 65 0B 00 00 80 00 00
00 00 00 00 00
Something like ÿþnever~stand upÿþ302218268-ÿþextremely~close
Any other ideas on how to mine sentences from the application? Maybe a batch script?
I am not so familiar with the C language and compiling it in Linux but I have something to ask and hope you can assist.
I have this line of code that uses an installed command and its parameters to join domain. (see pic).
After I run gcc join.c to compile it its created a file a.out.
So far so good but when I run vim a.out to view to content of that file I see mypassword can be easily viewed by a simple text editor. (see second pic)
Is there anything I can do to avoid this when compiling my C code?
#include <stdio.h>
#include <unistd.h>
int main ()
{
printf("Running 'net join' with the following parameters: \n");
char *domain="mydomain";
char *user="domainjoinuser";
char *pass="mypassword";
char *vastool="/opt/quest/bin/vastool";
char *ou="OU=test,DC=mtdomain,DC=local";
char unjoin[512];
sprintf(unjoin,"/opt/quest/in/vastool -u %s -w '%s' unjoin -f",user,pass);
printf("Domain: %s\n",domain);
printf("User: %s\n",user);
printf("-----------------\n");
printf("Unjoin.............\n");
system(unjoin);
printf("Join................\n");
execl("/opt/quest/bin/vastool", "vastool", "-u", user, "-w", pass, "join", "-c", "ou", "-f", domain, (char*)0);
}
00000000 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 |.ELF............|
00000010 02 00 3e 00 01 00 00 00 40 83 04 08 00 00 00 00 |..>.....#.......|
00000020 40 00 00 00 00 00 00 00 40 0a 00 00 00 00 00 00 |#.......#.......|
00000030 00 00 00 00 40 00 38 00 04 00 40 00 1c 00 1b 00 |....#.8...#.....|
00000040 03 00 00 00 04 00 00 00 20 01 00 00 00 00 00 00 |........ .......|
00000050 20 81 04 08 00 00 00 00 20 81 04 08 00 00 00 00 | ....... .......|
00000060 1c 00 00 00 00 00 00 00 1c 00 00 00 00 00 00 00 |................|
00000070 01 00 00 00 00 00 00 00 01 00 00 00 05 00 00 00 |................|
00000080 20 01 00 00 00 00 00 00 20 81 04 08 00 00 00 00 | ....... .......|
00000090 20 81 04 08 00 00 00 00 b0 05 00 00 00 00 00 00 | ...............|
000000a0 b0 05 00 00 00 00 00 00 00 10 00 00 00 00 00 00 |................|
000000b0 01 00 00 00 06 00 00 00 e0 06 00 00 00 00 00 00 |................|
000000c0 e0 96 04 08 00 00 00 00 e0 96 04 08 00 00 00 00 |................|
000000d0 60 02 00 00 00 00 00 00 60 02 00 00 00 00 00 00 |`.......`.......|
000000e0 00 10 00 00 00 00 00 00 02 00 00 00 06 00 00 00 |................|
000000f0 24 08 00 00 00 00 00 00 24 98 04 08 00 00 00 00 |$.......$.......|
00000100 24 98 04 08 00 00 00 00 a0 00 00 00 00 00 00 00 |$...............|
00000110 a0 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 |................|
00000120 2f 6c 69 62 36 34 2f 6c 64 2d 6c 69 6e 75 78 2d |/lib64/ld-linux-|
00000130 78 38 36 2d 36 34 2e 73 6f 2e 32 00 00 00 00 00 |x86-64.so.2.....|
00000140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000150 00 00 00 00 01 00 00 00 12 00 00 00 70 86 04 08 |............p...|
00000160 00 00 00 00 c0 01 00 00 00 00 00 00 13 00 00 00 |................|
00000170 12 00 00 00 80 86 04 08 00 00 00 00 a1 00 00 00 |................|
00000180 00 00 00 00 1a 00 00 00 12 00 00 00 90 86 04 08 |................|
00000190 00 00 00 00 8f 00 00 00 00 00 00 00 22 00 00 00 |............"...|
000001a0 12 00 00 00 a0 86 04 08 00 00 00 00 61 00 00 00 |............a...|
000001b0 00 00 00 00 29 00 00 00 12 00 00 00 b0 86 04 08 |....)...........|
000001c0 00 00 00 00 b0 01 00 00 00 00 00 00 2f 00 00 00 |............/...|
000001d0 12 00 0c 00 80 86 04 08 00 00 00 00 00 00 00 00 |................|
000001e0 00 00 00 00 35 00 00 00 20 00 00 00 00 00 00 00 |....5... .......|
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 5f 5f 6c |.............__l|
00000200 69 62 63 5f 73 74 61 72 74 5f 6d 61 69 6e 00 70 |ibc_start_main.p|
00000210 72 69 6e 74 66 00 73 70 72 69 6e 74 66 00 73 79 |rintf.sprintf.sy|
00000220 73 74 65 6d 00 65 78 65 63 6c 00 5f 69 6e 69 74 |stem.execl._init|
00000230 00 5f 5f 67 6d 6f 6e 5f 73 74 61 72 74 5f 5f 00 |.__gmon_start__.|
00000240 6c 69 62 63 2e 73 6f 2e 36 00 00 00 04 00 00 00 |libc.so.6.......|
00000250 08 00 00 00 06 00 00 00 04 00 00 00 03 00 00 00 |................|
00000260 07 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 |................|
00000270 02 00 00 00 00 00 00 00 00 00 00 00 05 00 00 00 |................|
00000280 00 00 00 00 f8 98 04 08 00 00 00 00 07 00 00 00 |................|
00000290 01 00 00 00 00 00 00 00 00 00 00 00 00 99 04 08 |................|
000002a0 00 00 00 00 07 00 00 00 02 00 00 00 00 00 00 00 |................|
000002b0 00 00 00 00 08 99 04 08 00 00 00 00 07 00 00 00 |................|
000002c0 03 00 00 00 00 00 00 00 00 00 00 00 10 99 04 08 |................|
000002d0 00 00 00 00 07 00 00 00 04 00 00 00 00 00 00 00 |................|
000002e0 00 00 00 00 18 99 04 08 00 00 00 00 07 00 00 00 |................|
000002f0 05 00 00 00 00 00 00 00 00 00 00 00 20 99 04 08 |............ ...|
00000300 00 00 00 00 07 00 00 00 06 00 00 00 00 00 00 00 |................|
00000310 00 00 00 00 28 99 04 08 00 00 00 00 06 00 00 00 |....(...........|
00000320 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000330 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000340 31 ed 49 89 d1 5e 48 89 e2 48 83 e4 f0 50 54 49 |1.I..^H..H...PTI|
00000350 c7 c0 90 85 04 08 48 c7 c1 00 85 04 08 48 c7 c7 |......H......H..|
00000360 6c 83 04 08 e8 07 03 00 00 f4 66 90 55 48 89 e5 |l.........f.UH..|
00000370 48 81 ec 30 02 00 00 48 8d 05 66 13 00 00 48 89 |H..0...H..f...H.|
00000380 c7 b8 00 00 00 00 e8 f5 02 00 00 48 8d 05 86 13 |...........H....|
00000390 00 00 48 89 45 f8 48 8d 05 84 13 00 00 48 89 45 |..H.E.H......H.E|
000003a0 f0 48 8d 05 88 13 00 00 48 89 45 e8 48 8d 05 88 |.H......H.E.H...|
000003b0 13 00 00 48 89 45 e0 48 8d 05 94 13 00 00 48 89 |...H.E.H......H.|
000003c0 45 d8 48 8b 45 e8 49 89 c3 48 8b 45 f0 49 89 c2 |E.H.E.I..H.E.I..|
000003d0 48 8d 05 98 13 00 00 48 89 c6 48 8d 85 d8 fd ff |H......H..H.....|
000003e0 ff 48 89 c7 4c 89 d2 4c 89 d9 b8 00 00 00 00 e8 |.H..L..L........|
000003f0 9c 02 00 00 48 8b 45 f8 48 89 c6 48 8d 05 9b 13 |....H.E.H..H....|
00000400 00 00 48 89 c7 b8 00 00 00 00 e8 71 02 00 00 48 |..H........q...H|
00000410 8b 45 f0 48 89 c6 48 8d 05 8c 13 00 00 48 89 c7 |.E.H..H......H..|
00000420 b8 00 00 00 00 e8 56 02 00 00 48 8d 05 82 13 00 |......V...H.....|
00000430 00 48 89 c7 b8 00 00 00 00 e8 42 02 00 00 48 8d |.H........B...H.|
00000440 05 81 13 00 00 48 89 c7 b8 00 00 00 00 e8 2e 02 |.....H..........|
00000450 00 00 48 8d 85 d8 fd ff ff 48 89 c7 b8 00 00 00 |..H......H......|
00000460 00 e8 3a 02 00 00 48 8d 05 6e 13 00 00 48 89 c7 |..:...H..n...H..|
00000470 b8 00 00 00 00 e8 06 02 00 00 48 b8 00 00 00 00 |..........H.....|
00000480 00 00 00 00 50 48 8b 45 f8 50 48 8d 05 90 13 00 |....PH.E.PH.....|
00000490 00 50 48 8d 05 85 13 00 00 50 48 8d 05 7a 13 00 |.PH......PH..z..|
000004a0 00 50 48 8d 05 6d 13 00 00 50 48 8b 45 e8 49 89 |.PH..m...PH.E.I.|
000004b0 c1 48 8d 05 5b 13 00 00 49 89 c0 48 8b 45 f0 49 |.H..[...I..H.E.I|
000004c0 89 c3 48 8d 05 47 13 00 00 49 89 c2 48 8d 05 35 |..H..G...I..H..5|
000004d0 13 00 00 48 89 c6 48 8d 05 14 13 00 00 48 89 c7 |...H..H......H..|
000004e0 4c 89 d2 4c 89 d9 b8 00 00 00 00 e8 c0 01 00 00 |L..L............|
000004f0 48 83 c4 30 c9 c3 00 00 00 00 00 00 00 00 00 00 |H..0............|
00000500 48 89 6c 24 d8 4c 89 64 24 e0 48 8d 2d 4f 01 00 |H.l$.L.d$.H.-O..|
00000510 00 4c 8d 25 48 01 00 00 48 89 5c 24 d0 4c 89 6c |.L.%H...H.\$.L.l|
00000520 24 e8 4c 89 74 24 f0 4c 89 7c 24 f8 48 83 ec 38 |$.L.t$.L.|$.H..8|
00000530 4c 29 e5 41 89 ff 49 89 f6 48 c1 fd 03 49 89 d5 |L).A..I..H...I..|
00000540 31 db e8 d9 00 00 00 48 85 ed 74 1a 0f 1f 40 00 |1......H..t...#.|
00000550 4c 89 ea 4c 89 f6 44 89 ff 41 ff 14 dc 48 83 c3 |L..L..D..A...H..|
00000560 01 48 39 eb 75 ea 48 8b 5c 24 08 48 8b 6c 24 10 |.H9.u.H.\$.H.l$.|
00000570 4c 8b 64 24 18 4c 8b 6c 24 20 4c 8b 74 24 28 4c |L.d$.L.l$ L.t$(L|
00000580 8b 7c 24 30 48 83 c4 38 c3 0f 1f 80 00 00 00 00 |.|$0H..8........|
00000590 f3 c3 00 00 01 00 02 00 14 00 00 00 00 00 00 00 |................|
000005a0 01 7a 52 00 01 78 10 01 1b 0c 07 08 90 01 07 10 |.zR..x..........|
000005b0 14 00 00 00 1c 00 00 00 88 fd ff ff 2a 00 00 00 |............*...|
000005c0 00 00 00 00 00 00 00 00 14 00 00 00 00 00 00 00 |................|
000005d0 01 7a 52 00 01 78 10 01 1b 0c 07 08 90 01 00 00 |.zR..x..........|
000005e0 24 00 00 00 1c 00 00 00 18 ff ff ff 89 00 00 00 |$...............|
000005f0 00 4a 86 06 8c 05 66 0e 40 83 07 8d 04 8e 03 8f |.J....f.#.......|
00000600 02 02 58 0e 08 00 00 00 14 00 00 00 44 00 00 00 |..X.........D...|
00000610 80 ff ff ff 02 00 00 00 00 00 00 00 00 00 00 00 |................|
00000620 48 83 ec 08 48 8b 05 fd 12 00 00 48 85 c0 74 05 |H...H......H..t.|
00000630 e8 cb 79 fb f7 48 83 c4 08 c3 00 00 48 83 ec 08 |..y..H......H...|
00000640 48 83 c4 08 c3 00 00 00 00 00 00 00 00 00 00 00 |H...............|
00000650 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000660 ff 35 82 12 00 00 ff 25 84 12 00 00 00 00 00 00 |.5.....%........|
00000670 ff 25 82 12 00 00 68 00 00 00 00 e9 e0 ff ff ff |.%....h.........|
00000680 ff 25 7a 12 00 00 68 08 00 00 00 e9 d0 ff ff ff |.%z...h.........|
00000690 ff 25 72 12 00 00 68 10 00 00 00 e9 c0 ff ff ff |.%r...h.........|
000006a0 ff 25 6a 12 00 00 68 18 00 00 00 e9 b0 ff ff ff |.%j...h.........|
000006b0 ff 25 62 12 00 00 68 20 00 00 00 e9 a0 ff ff ff |.%b...h ........|
000006c0 ff 25 5a 12 00 00 68 28 00 00 00 e9 90 ff ff ff |.%Z...h(........|
000006d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000006e0 00 00 00 00 52 75 6e 6e 69 6e 67 20 27 6e 65 74 |....Running 'net|
000006f0 20 6a 6f 69 6e 27 20 77 69 74 68 20 74 68 65 20 | join' with the |
00000700 66 6f 6c 6c 6f 77 69 6e 67 20 70 61 72 61 6d 65 |following parame|
00000710 74 65 72 73 3a 20 0a 00 6d 79 64 6f 6d 61 69 6e |ters: ..mydomain|
00000720 00 64 6f 6d 61 69 6e 6a 6f 69 6e 75 73 65 72 00 |.domainjoinuser.|
00000730 6d 79 70 61 73 73 77 6f 72 64 00 2f 6f 70 74 2f |mypassword./opt/|
00000740 71 75 65 73 74 2f 62 69 6e 2f 76 61 73 74 6f 6f |quest/bin/vastoo|
00000750 6c 00 4f 55 3d 74 65 73 74 2c 44 43 3d 6d 74 64 |l.OU=test,DC=mtd|
00000760 6f 6d 61 69 6e 2c 44 43 3d 6c 6f 63 61 6c 00 2f |omain,DC=local./|
00000770 6f 70 74 2f 71 75 65 73 74 2f 69 6e 2f 76 61 73 |opt/quest/in/vas|
00000780 74 6f 6f 6c 20 2d 75 20 25 73 20 2d 77 20 27 25 |tool -u %s -w '%|
00000790 73 27 20 75 6e 6a 6f 69 6e 20 2d 66 00 44 6f 6d |s' unjoin -f.Dom|
000007a0 61 69 6e 3a 20 25 73 0a 00 55 73 65 72 3a 20 25 |ain: %s..User: %|
000007b0 73 0a 00 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |s..-------------|
000007c0 2d 2d 2d 2d 0a 00 55 6e 6a 6f 69 6e 2e 2e 2e 2e |----..Unjoin....|
000007d0 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 00 4a 6f 69 6e 2e |...........Join.|
000007e0 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a |................|
000007f0 00 2f 6f 70 74 2f 71 75 65 73 74 2f 62 69 6e 2f |./opt/quest/bin/|
00000800 76 61 73 74 6f 6f 6c 00 76 61 73 74 6f 6f 6c 00 |vastool.vastool.|
00000810 2d 75 00 2d 77 00 6a 6f 69 6e 00 2d 63 00 6f 75 |-u.-w.join.-c.ou|
00000820 00 2d 66 00 01 00 00 00 00 00 00 00 44 00 00 00 |.-f.........D...|
00000830 00 00 00 00 04 00 00 00 00 00 00 00 4c 82 04 08 |............L...|
...
Is there anything i can do to avoid this when compiling my C code?
The only thing you can do is to not hard-code the password or any sensitive information into your C program: even if you encrypt this sensitive information in one way or the other, either the decryption key would need to be provided at runtime by a user running your program, or the info could be decrypted by a sufficiently motivated person. You might as well prompt the user for the password.
Note that any other form of hiding would be a mere obfuscation - a small obstacle on the way of a user who is trying to access your secret information. It may deter a few "script kiddies", but it would fall to the first knowledgeable user.
As dasblinkenlight pointed out, whatever you do will not deter somebody from getting your password. For instance, he could run strace on your program to figure out which arguments are being passed to vastool, or he could use a debugger. If you write programs with the intent of being secure, always keep Kerkhoff's principle in mind:
A (crypto-) system should be secure even if everything about the system [...] is public knowledge.
However, if you like some extra smokescreen security obfuscation, you might want to have a look at the memfrob(3) function:
void *memfrob(void *s, size_t n);
The memfrob() function
encrypts the first n bytes of the memory area s by exclusive-ORing
each character with the number 42. The effect can be reversed by using
memfrob() on the encrypted memory area.
Note that this function is not a proper encryption routine as the XOR
constant is fixed, and is only suitable for hiding strings.
one way is to use a function (rot13(), reverse(), chartobinary() f.e.) and call your function with the encoded string.
I had mounted a fusecompress of directory compressed/ at fusecompress/
I copied a large file (several GB) to the fusecompress directory (ok, I mv'd it).
The compressed file in the directory compressed/ is length 1,221,396,660.
However, I cannot remove/uncompress the file. fusecompress has a memory error: "Cannot allocate memory".
Is there anyway to utilize the lzo library to write a decompress routine for the compressed file?
I tried the following, but got a segmentation fault:
char buffer[OUT_LEN];
char outbuffer[IN_LEN];
int read;
lzo_uint writ;
unsigned long totalWrit = 0;
while( (read = fread( buffer, sizeof(char), OUT_LEN, stdin )) > 0 )
{
r = lzo1x_decompress( buffer, read, outbuffer, &writ, NULL );
fwrite( outbuffer, sizeof(char), writ, stdout );
totalWrit += writ;
}
fprintf( stderr, "\nDone. %d bytes written out.\n\n", totalWrit );
Update:
In response to bill, the first 160 bytes of the file are:
00000000 01 1f 01 5d ff 89 04 00 a2 20 85 04 30 6e ba 48 |...]..... ..0n.H|
00000010 00 00 01 02 00 00 00 00 00 00 11 3c 3c 3c 20 53 |...........<<< S|
00000020 75 6e 20 56 69 72 74 75 61 6c 42 6f 78 20 44 69 |un VirtualBox Di|
00000030 73 6b 20 49 6d 61 67 65 20 3e 3e 3e 0a 00 3b 00 |sk Image >>>..;.|
00000040 00 08 7f 10 da be 01 00 01 00 90 01 00 54 00 3b |.............T.;|
00000050 a8 00 20 c9 70 00 02 02 00 00 00 a2 2d b8 03 6c |.. .p.......-..l|
00000060 02 a9 02 80 a9 01 10 b4 01 00 15 28 00 00 52 08 |...........(..R.|
00000070 00 00 a4 15 30 3e 76 22 73 4c 96 3d bf 8f ca 66 |....0>v"sL.=...f|
00000080 a8 93 2b a6 83 65 44 4d 37 41 a4 02 ca bb 56 4e |..+..eDM7A....VN|
00000090 a9 e9 b0 05 39 14 00 05 04 00 00 ff 00 00 00 3f |....9..........?|
You must look how the file was compressed. Witch Header and additional data are stored in the file.