hi all,
i was thinking about to write a little mail client in asm.
But before i have to learn what are the api to use, and how work the pop/smto mail protocol.
Maybe someone of you know some link/tutorial where to start.
Thanks B7
i was thinking about to write a little mail client in asm.
But before i have to learn what are the api to use, and how work the pop/smto mail protocol.
Maybe someone of you know some link/tutorial where to start.
Thanks B7
Get the winsock 2 reference from my site, and have a look at the winsock FAQ in the link section of my site.
You can find all info on internet protocols at http://www.rfc-editor.org
Thomas
You can find all info on internet protocols at http://www.rfc-editor.org
Thomas
You can also find the RFCs on http://www.faqs.org . I dunno which
one is best, but it wouldn't hurt to bookmark both. Note that a lot
of the work with writing an email client seems to be working around
bugs in server software :/.
one is best, but it wouldn't hurt to bookmark both. Note that a lot
of the work with writing an email client seems to be working around
bugs in server software :/.
An equal amount of time will be spent writing the attachment encode/decode routines for uuencode,mime,etc. and figuring out how to handle multipart messages. What I'm saying is don't just read SMTP rfc. Read all the extensions as well. Especially mime.
Minimum thing is to thanks again to be always ready to answer to me.
I will study.... :)
B7
I will study.... :)
B7
SMG agent (anonymous mailer -- written with masm)
the author is Mio
I've got the source somewhere, but I'm sure you'll be able to search for it... if not I can check around for it...
Might help you along the way...
Sliver
the author is Mio
I've got the source somewhere, but I'm sure you'll be able to search for it... if not I can check around for it...
Might help you along the way...
Sliver
i was thinking about to write a little mail client in asm.
You too? :grin:
Mine is nearly finished... just rewroting the HTML parser :)
great ! It was long to write ??
errm... yes! Whole source is about 10.000 lines now and there are still some parts missing...
mmhh,
that make me thinking a lot...
hope my client will be a 'low line' edition...
BYE B7
that make me thinking a lot...
hope my client will be a 'low line' edition...
BYE B7
What about using MAPI and then custom coding only what you need to?
What about using MAPI and then custom coding only what you need to?
simple answer:
[*]MAPI sucks
[*]pure winsock not :)
- MAPI sucks
Agreed, but if the problem is not wanting to code 10,000 lines for a mail client...
Agreed, but if the problem is not wanting to code 10,000 lines for a mail client...
The mail send/recv part is the smallest :-) But message storing, attachment handling, and HTML parsing need a lot lines... and of course the nice GUI (pure API, no RC).
Bazik, are you parsing the html in multipart messages totally inside your app?
Bazik, are you parsing the html in multipart messages totally inside your app?
yes! But this is the part of my mail client, wich still needs a lot of work... :-/
I hate HTML emails :grin:
Is it going to support IMAP ? or just POP3?
Is it going to support IMAP ? or just POP3?
Hmm.... for now just POP3... but IMAP sounds like a great idea!
Didn't thought about it before :)
hello, i was thinking to in write an MailClient... but... i've even begin it. The first thing i do was, search on the web an asm mime64 encoder/decoder. But i don't find'm anyware... soo i decide to try convert a C++ code to Asm code... and here they are... (i don't have time to code optimizations..., and i'm sure that they can be optimized...)
MIME64 encoder/decoder:
In this code, u should find things that aren't needed,... this was a temp asm...
Here is the encoder:
UUE Encoder
I don't gonna code another mail client since i don't have time :(
But i hoppe this help some's one asm client app.
I would like to see, the working app... :)
bye
Jean / Coder7345
MIME64 encoder/decoder:
;This is the MIME64 decoder...
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\comdlg32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\comdlg32.lib
m2m MACRO M1, M2
push M2
pop M1
ENDM
cvt_ascii PROTO :DWORD
.data
szText db "xxxxxxxxxxx",0
XFile db "asdfsdf %lu",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
buff db 256 dup(0)
data db "ABC"
encbin db "QUJD",0
Enconding_Table db "ABCDEFGHIJKLMNOPQRSTUVXYZ"
db "abcdefghijklmnopqrstuvxyz"
db '0123456789+/'
intVal dd 123456
baseX dd 10
ptBuffer dd offset buff
numberstable db '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
StartTime dd 0
template db "50000 calls takes: %lu mili-seconds",0
accum dd ?
shift dd ?
.data?
ofn OPENFILENAME <>
.const
.code
start:
mov esi,offset encbin
mov edi,offset buff
NextByte:
xor eax,eax
mov al,byte ptr [esi]
or al,al
jz quit
invoke cvt_ascii,eax
.if eax>64
jmp quit
.endif
shl accum,6
add shift,6
or eax,accum
mov accum,eax
.if (shift>=8)
sub shift,8
mov eax,accum
mov ecx,shift
shr eax,cl ;shift
mov byte ptr [edi],al
inc edi
.endif
inc esi
jmp NextByte
quit:
invoke MessageBox,0,addr buff,0,0
invoke ExitProcess,0
cvt_ascii proc alpha:DWORD
mov eax,alpha
.if ( (alpha >= 'A') && (alpha <= 'Z') )
sub eax,'A'
;ret (int)(alpha - 'A')
.elseif ( (alpha >= 'a') && (alpha <= 'z') )
;return 26 + (int)(alpha - 'a');
sub eax,'a'
add eax,26
.elseif ( (alpha >= '0') && (alpha <= '9' ) )
sub eax,'0'
add eax,52
; return 52 + (int)(alpha - '0');
.elseif ( alpha == '+' )
mov eax,62
.elseif ( alpha == '/' )
mov eax,63
.elseif ( alpha == '=' )
mov eax,-2
.else
mov eax,-1
.endif
ret
cvt_ascii endp
end start
In this code, u should find things that aren't needed,... this was a temp asm...
Here is the encoder:
?????????????????????????????????????????????????????????????????[MIME.ASM]???
; MIME attachment encoder.
; By: T-2000/Immortal Riot (vx makers zine)
.386
.MODEL FLAT
.DATA
EXTRN ExitProcess:PROC
EXTRN CreateFileA:PROC
EXTRN CloseHandle:PROC
EXTRN ReadFile:PROC
EXTRN WriteFile:PROC
EXTRN GetFileSize:PROC
OPEN_EXISTING EQU 00000003h
CREATE_ALWAYS EQU 00000002h
FILE_ATTRIBUTE_NORMAL EQU 00000080h
GENERIC_READ EQU 80000000h
GENERIC_WRITE EQU 40000000h
START:
XOR EBX, EBX
PUSH EBX
PUSH FILE_ATTRIBUTE_NORMAL
PUSH OPEN_EXISTING
PUSH EBX
PUSH EBX
PUSH GENERIC_READ
CALL @1
DB 'INPUT.BIN', 0 ; Binary you want to encode.
@1: CALL CreateFileA
MOV [Input_Handle], EAX
PUSH EBX
PUSH FILE_ATTRIBUTE_NORMAL
PUSH CREATE_ALWAYS
PUSH EBX
PUSH EBX
PUSH GENERIC_WRITE
CALL @2
DB 'OUTPUT.EML', 0
@2: CALL CreateFileA
MOV [Output_Handle], EAX
PUSH EBX
PUSH OFFSET IO_Bytes_Count
PUSH (@4-@3)
CALL @4
@3: DB 'MIME-Version: 1.0', 0Dh, 0Ah
DB 'Content-Type: multipart/mixed; boundary=ir', 0Dh, 0Ah
DB 0Dh, 0Ah
DB '--ir', 0Dh, 0Ah
DB 0Dh, 0Ah
DB 'this is plain text', 0Dh, 0Ah
DB '--ir', 0Dh, 0Ah
DB 'Content-Type: application; name=binary.exe', 0Dh, 0Ah
DB 'Content-Transfer-Encoding: base64', 0Dh, 0Ah
DB 0Dh, 0Ah
@4: PUSH [Output_Handle]
CALL WriteFile
PUSH EBX
PUSH [Input_Handle]
CALL GetFileSize
CDQ
MOV ECX, (76/4)*3
DIV ECX
DEC EDX
JS No_Round
INC EAX
No_Round: XCHG ECX, EAX
Encode_Line: PUSH ECX
MOV ESI, OFFSET Input_Buffer
PUSH 0
PUSH OFFSET IO_Bytes_Count
PUSH (76/4)*3
PUSH ESI
PUSH [Input_Handle]
CALL ReadFile
MOV EDI, OFFSET Output_Buffer
PUSH EDI
PUSH 76/4
POP ECX
Encode_Packet: PUSH ECX
MOV CL, 8
LODSB
SHL EAX, CL
LODSB
SHL EAX, CL
LODSB
SHL EAX, CL
MOV EBX, OFFSET Encoding_Table
MOV CL, 4
Encode_Byte: SHR EAX, 2
ROL EAX, 8
XLAT
STOSB
LOOP Encode_Byte
POP ECX
LOOP Encode_Packet
MOV WORD PTR [EDI], 0A0Dh ; <CRLF>.
POP EAX
PUSH 0
PUSH OFFSET IO_Bytes_Count
PUSH 78
PUSH EAX
PUSH [Output_Handle]
CALL WriteFile
POP ECX
LOOP Encode_Line
PUSH 0
CALL @5
IO_Bytes_Count DD 0
@5: PUSH (@7-@6)
CALL @7
@6: DB '--ir--', 0Dh, 0Ah
@7: PUSH [Output_Handle]
CALL WriteFile
PUSH 12345678h
Output_Handle = DWORD PTR $-4
CALL CloseHandle
PUSH 12345678h
Input_Handle = DWORD PTR $-4
CALL CloseHandle
Exit: PUSH 0
CALL ExitProcess
Encoding_Table: DB 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
DB 'abcdefghijklmnopqrstuvwxyz'
DB '0123456789+/'
Input_Buffer DB 200 DUP(0)
Output_Buffer DB 200 DUP(0)
END START
?????????????????????????????????????????????????????????????????[MIME.ASM]???
UUE Encoder
?????????????????????????????????????????????????????????????[UUENCODE.ASM]???
; UUENCODE attachment encoder.
.386
.MODEL FLAT
.DATA
EXTRN ExitProcess:PROC
EXTRN CreateFileA:PROC
EXTRN CloseHandle:PROC
EXTRN ReadFile:PROC
EXTRN WriteFile:PROC
EXTRN GetFileSize:PROC
OPEN_EXISTING EQU 00000003h
CREATE_ALWAYS EQU 00000002h
FILE_ATTRIBUTE_NORMAL EQU 00000080h
GENERIC_READ EQU 80000000h
GENERIC_WRITE EQU 40000000h
START:
XOR EBX, EBX
PUSH EBX
PUSH FILE_ATTRIBUTE_NORMAL
PUSH OPEN_EXISTING
PUSH EBX
PUSH EBX
PUSH GENERIC_READ
CALL @1
DB 'INPUT.BIN', 0
@1: CALL CreateFileA
MOV [Input_Handle], EAX
PUSH EBX
PUSH FILE_ATTRIBUTE_NORMAL
PUSH CREATE_ALWAYS
PUSH EBX
PUSH EBX
PUSH GENERIC_WRITE
CALL @2
DB 'OUTPUT.UUE', 0
@2: CALL CreateFileA
MOV [Output_Handle], EAX
PUSH EBX
PUSH OFFSET IO_Bytes_Count
PUSH 22
CALL @3
DB 'begin 644 binary.exe', 0Dh, 0Ah
@3: PUSH [Output_Handle]
CALL WriteFile
PUSH EBX
PUSH [Input_Handle]
CALL GetFileSize
XOR EDX, EDX
MOV ECX, 45
DIV ECX
DEC EDX
JS No_Round
INC EAX
No_Round: XCHG ECX, EAX
Encode_Line: PUSH ECX
MOV ESI, OFFSET Input_Buffer
PUSH 0
PUSH OFFSET IO_Bytes_Count
PUSH 45
PUSH ESI
PUSH [Input_Handle]
CALL ReadFile
MOV EDI, OFFSET Output_Buffer
CLD
MOV AL, (45 + 20h) ; Decoded length of 45 bytes.
STOSB
PUSH (45 / 3) ; Process 45 bytes.
POP ECX
Encode_DWORD: LODSD
DEC ESI
SHL EAX, 8
MOV BH, AH
ROL EAX, 8
XCHG AL, BH
ROR EAX, 8
MOV AH, BH
PUSH ECX
PUSH 4
POP ECX
Encode_Byte: SHR EAX, 2
ROR EAX, 3*8
ADD AL, 20h
CMP AL, 20h ; It's a space?
JNE Store_Encoded
MOV AL, 60h
Store_Encoded: STOSB
ROL EAX, 3*8
SHL EAX, 8
LOOP Encode_Byte
POP ECX
LOOP Encode_DWORD
MOV AX, 0A0Dh ; Store <CR> & <LF>.
STOSW
PUSH 0
PUSH OFFSET IO_Bytes_Count
PUSH 63
PUSH OFFSET Output_Buffer
PUSH [Output_Handle]
CALL WriteFile
POP ECX
LOOP Encode_Line
PUSH ECX
CALL @4
IO_Bytes_Count DD 0
@4: PUSH 8
CALL @5
DB '`', 0Dh, 0Ah, 'end', 0Dh, 0Ah
@5: PUSH [Output_Handle]
CALL WriteFile
PUSH 12345678h
Output_Handle = DWORD PTR $-4
CALL CloseHandle
PUSH 12345678h
Input_Handle = DWORD PTR $-4
CALL CloseHandle
Exit: PUSH 0
CALL ExitProcess
Input_Buffer DB 45 DUP(0)
Output_Buffer DB 63 DUP(0)
END START
?????????????????????????????????????????????????????????????[UUENCODE.ASM]???
I don't gonna code another mail client since i don't have time :(
But i hoppe this help some's one asm client app.
I would like to see, the working app... :)
bye
Jean / Coder7345
Oh, by the way:
My mail client is on it's best way to be open-source!
I'm just waiting for the authorization of SourceForge :)
My mail client is on it's best way to be open-source!
I'm just waiting for the authorization of SourceForge :)