SMTPの仕様に従っていない、SMTPもどきサーバー。 by Ruby
-----
require 'socket'
require 'kconv'
def log(*str)
str.each{|s|
print s.to_s.tosjis
}
end
class String
def startwith(str)
self.slice(0, str.length) === str
end
end
gs = TCPServer.open(25)
addr = gs.addr
addr.shift
printf("server is on %s\n", addr.join(':'))
while true
Thread.start(gs.accept) do |s|
log s, " is accepted.\n"
s.write "220 OK\r\n"
line = s.gets
if line.startwith('EHLO')
s.write "502 ERR\r\n"
line = s.gets
end
if !line.startwith('HELO')
s.write "500 ERR\r\n"
s.close
return
end
s.write "250 OK\r\n"
while !(line = s.gets).startwith('DATA')
s.write "250 OK\r\n"
log line
end
s.write "354 ENTER\r\n"
log line
while !((line = s.gets) === ".\r\n")
log line
end
s.write "250 OK\r\n"
if !(line = s.gets).startwith('QUIT')
s.write "500 ERR\r\n"
s.close
return
end
s.write "221 CLOSE\r\n"
def log(*str)
str.each{|s|
print s.to_s.tosjis
}
end
class String
def startwith(str)
self.slice(0, str.length) === str
end
end
gs = TCPServer.open(25)
addr = gs.addr
addr.shift
printf("server is on %s\n", addr.join(':'))
while true
Thread.start(gs.accept) do |s|
log s, " is accepted.\n"
s.write "220 OK\r\n"
line = s.gets
if line.startwith('EHLO')
s.write "502 ERR\r\n"
line = s.gets
end
if !line.startwith('HELO')
s.write "500 ERR\r\n"
s.close
return
end
s.write "250 OK\r\n"
while !(line = s.gets).startwith('DATA')
s.write "250 OK\r\n"
log line
end
s.write "354 ENTER\r\n"
log line
body = []
while !((line = s.gets) === ".\r\n")
log line
body.push line
end
s.write "250 OK\r\n"
if !(line = s.gets).startwith('QUIT')
s.write "500 ERR\r\n"
s.close
return
end
s.write "221 CLOSE\r\n"
log s, " is done.\n"
s.close
if body.length != 0
key = nil
bodystr = ''
body.each do |line|
if line.startwith 'To:'
key = line[/\d{10,}/]
break
end
end
lambda do
state = 0
body.each do |line|
if state == 0 && line == "\r\n"
state = 1
elsif state == 1
bodystr << line.chomp << "\n"
end
end
end.call
Net::HTTP.post_form(
URI.parse('http://jbbs.livedoor.jp/bbs/write.cgi/computer/38153/1307542890/'),
{
'DIR' => 'computer',
'BBS' => '38153',
'KEY' => key,
'TIME' => Time.now.to_i.to_s,
'NAME' => '',
'MAIL' => '',
'MESSAGE' => bodystr.toeuc
}
) if key != nil && !bodystr.empty?
end
end
end
SELECT down_table.sikepuri_id AS sikepuri_id, down_table.down_count AS down_count, sikepuri_table.sikepuri_title AS sikepuri_title, sikepuri_table.sikepuri_creater AS sikepuri_creater, sikepuri_table.sikepuri_kind AS sikepuri_kind, sikepuri_table.classdata_id AS classdata_id, sikepuri_table.classdata_name1 AS classdata_name1, sikepuri_table.classdata_count AS classdata_count FROM (SELECT sikepuri_id, COUNT(*) AS down_count FROM sikepuri_downlog GROUP BY sikepuri_id) AS down_table, (SELECT sikepuri.id AS sikepuri_id, sikepuri.title AS sikepuri_title, sikepuri.kind AS sikepuri_kind, sikepuri.creater AS sikepuri_creater, classdata.id AS classdata_id, classdata.name1 AS classdata_name1, COUNT(DISTINCT classdata.id) AS classdata_count FROM sikepuri LEFT JOIN sikepuri_link ON sikepuri.id = sikepuri_link.sikepuri_id LEFT JOIN classdata ON sikepuri_link.classdata_id = classdata.id GROUP BY sikepuri.id) AS sikepuri_table WHERE down_table.sikepuri_id = sikepuri_table.sikepuri_id
Apply for WoSign Digital Certificates online: SSL Certificates| Code Signing Certificates| EV SSL Certificates | OV SSL Certificates | DV SSL Certificates | 2048bits Web Server Certificate, Support all types of browsers and servers, and support with Chinese in certificate subject, Support IDN domain names ! https://buy.wosign.com/free/
-----
中国製の無料SSL証明書発行サイトらしい
Think-Silicon/GLOVE: GLOVE (GL Over Vulkan) is a software library that acts as an intermediate layer between an OpenGL application and Vulkan https://github.com/Think-Silicon/GLOVE