merge with upstream
This commit is contained in:
commit
2112cbccb5
|
@ -19,7 +19,7 @@ along with sofSIM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
Copyright (C) 2011 Kevin "tsaitgaist" Redon kevredon@mail.tsaitgaist.info
|
Copyright (C) 2011 Kevin "tsaitgaist" Redon kevredon@mail.tsaitgaist.info
|
||||||
=end
|
=end
|
||||||
# this programm will forward APDU from an IO to a SAP server
|
# this programm will forward APDU from an IO to a SAP server
|
||||||
require './sap/client.rb'
|
require_relative 'sap/client'
|
||||||
require 'socket'
|
require 'socket'
|
||||||
|
|
||||||
SAP_HOST = "localhost"
|
SAP_HOST = "localhost"
|
||||||
|
|
|
@ -18,8 +18,8 @@ along with sofSIM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
Copyright (C) 2011 Kevin "tsaitgaist" Redon kevredon@mail.tsaitgaist.info
|
Copyright (C) 2011 Kevin "tsaitgaist" Redon kevredon@mail.tsaitgaist.info
|
||||||
=end
|
=end
|
||||||
# this class copies all files from the SIM to an xml file
|
# this class copies all files from the SIM to an xml file
|
||||||
require './sap/client.rb'
|
require_relative 'sap/client'
|
||||||
require './lib/apdu.rb'
|
require_relative 'lib/apdu'
|
||||||
require 'xml'
|
require 'xml'
|
||||||
|
|
||||||
class Copy
|
class Copy
|
||||||
|
|
|
@ -19,10 +19,10 @@ along with sofSIM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
Copyright (C) 2011 Kevin "tsaitgaist" Redon kevredon@mail.tsaitgaist.info
|
Copyright (C) 2011 Kevin "tsaitgaist" Redon kevredon@mail.tsaitgaist.info
|
||||||
=end
|
=end
|
||||||
# this programm will create a client which can be used to test servers
|
# this programm will create a client which can be used to test servers
|
||||||
require './sap/client.rb'
|
require_relative 'sap/client'
|
||||||
require './lib/apdu.rb'
|
require_relative 'lib/apdu'
|
||||||
require './info_client.rb'
|
require_relative 'info_client'
|
||||||
require './copy_client.rb'
|
require_relative 'copy_client'
|
||||||
|
|
||||||
#=============
|
#=============
|
||||||
#== default ==
|
#== default ==
|
||||||
|
@ -31,13 +31,13 @@ require './copy_client.rb'
|
||||||
# client use (demo,info,copy)
|
# client use (demo,info,copy)
|
||||||
@type = "demo"
|
@type = "demo"
|
||||||
# which IO to use (tcp,unix,bt)
|
# which IO to use (tcp,unix,bt)
|
||||||
@socket = "tcp"
|
@socket = "unix"
|
||||||
# tcp port
|
# tcp port
|
||||||
@port = 1337
|
@port = 1337
|
||||||
# tcp host
|
# tcp host
|
||||||
@host = "localhost"
|
@host = "localhost"
|
||||||
# unix socket
|
# unix socket
|
||||||
@unix = "/tmp/sap.socket"
|
@unix = "/tmp/osmocom_sap"
|
||||||
# file were to save the copy
|
# file were to save the copy
|
||||||
@file = "sim.xml"
|
@file = "sim.xml"
|
||||||
# bluetooth rfcomm serial port
|
# bluetooth rfcomm serial port
|
||||||
|
@ -131,7 +131,7 @@ when "bt"
|
||||||
if @bt then
|
if @bt then
|
||||||
io = SerialPort.new(@bt)
|
io = SerialPort.new(@bt)
|
||||||
else
|
else
|
||||||
require './tools/bluetooth_sap_serial.rb'
|
require_relative 'tools/bluetooth_sap_serial'
|
||||||
bt = BluetoothSAPSerial.new
|
bt = BluetoothSAPSerial.new
|
||||||
# using SerialPort because reading the File does not work (have to find right stty options)
|
# using SerialPort because reading the File does not work (have to find right stty options)
|
||||||
io = SerialPort.new(bt.connect)
|
io = SerialPort.new(bt.connect)
|
||||||
|
|
|
@ -27,11 +27,11 @@ Copyright (C) 2011 Kevin "tsaitgaist" Redon kevredon@mail.tsaitgaist.info
|
||||||
# the server to use (pcsc,sim)
|
# the server to use (pcsc,sim)
|
||||||
@type = "pcsc"
|
@type = "pcsc"
|
||||||
# which IO to use (tcp,unix)
|
# which IO to use (tcp,unix)
|
||||||
@socket = "tcp"
|
@socket = "unix"
|
||||||
# tcp port
|
# tcp port
|
||||||
@port = 1337
|
@port = 1337
|
||||||
# unix socket
|
# unix socket
|
||||||
@unix = "/tmp/sap.socket"
|
@unix = "/tmp/osmocom_sap"
|
||||||
# sim file
|
# sim file
|
||||||
@file = "sim.xml"
|
@file = "sim.xml"
|
||||||
# the verbosity (from common)
|
# the verbosity (from common)
|
||||||
|
@ -99,6 +99,10 @@ when "tcp"
|
||||||
socket = TCPServer.new("0.0.0.0",@port)
|
socket = TCPServer.new("0.0.0.0",@port)
|
||||||
when "unix"
|
when "unix"
|
||||||
require 'socket'
|
require 'socket'
|
||||||
|
if File.exists?(@unix)
|
||||||
|
puts 'Previous socket exists, deleting it...'
|
||||||
|
File.delete(@unix)
|
||||||
|
end
|
||||||
socket = UNIXServer.new(@unix)
|
socket = UNIXServer.new(@unix)
|
||||||
else
|
else
|
||||||
raise "please defined which socket to use"
|
raise "please defined which socket to use"
|
||||||
|
@ -108,10 +112,10 @@ io = socket.accept
|
||||||
|
|
||||||
case @type
|
case @type
|
||||||
when "pcsc"
|
when "pcsc"
|
||||||
require './pcsc_server.rb'
|
require_relative 'pcsc_server'
|
||||||
server = PCSCServer.new(io)
|
server = PCSCServer.new(io)
|
||||||
when "sim"
|
when "sim"
|
||||||
require './simos_server.rb'
|
require_relative 'simos_server'
|
||||||
server = SIMServer.new(io)
|
server = SIMServer.new(io)
|
||||||
else
|
else
|
||||||
raise "unkown server type"
|
raise "unkown server type"
|
||||||
|
|
|
@ -19,8 +19,8 @@ along with sofSIM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
Copyright (C) 2011 Kevin "tsaitgaist" Redon kevredon@mail.tsaitgaist.info
|
Copyright (C) 2011 Kevin "tsaitgaist" Redon kevredon@mail.tsaitgaist.info
|
||||||
=end
|
=end
|
||||||
# this programm will display information stored in the SIM
|
# this programm will display information stored in the SIM
|
||||||
require './sap/client.rb'
|
require_relative 'sap/client'
|
||||||
require './lib/apdu.rb'
|
require_relative 'lib/apdu'
|
||||||
|
|
||||||
#=============
|
#=============
|
||||||
#== methods ==
|
#== methods ==
|
||||||
|
|
|
@ -19,11 +19,7 @@ along with sofSIM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Copyright (C) 2011 Kevin "tsaitgaist" Redon kevredon@mail.tsaitgaist.info
|
Copyright (C) 2011 Kevin "tsaitgaist" Redon kevredon@mail.tsaitgaist.info
|
||||||
=end
|
=end
|
||||||
# this librarie is to centralise the APDU related work
|
# this library is to centralise the APDU related work
|
||||||
|
|
||||||
# required by ruby 1.8, but brakes 1.9
|
|
||||||
#$KCODE = 'UTF8'
|
|
||||||
#require 'jcode'
|
|
||||||
|
|
||||||
# transform binary string into readable hex string
|
# transform binary string into readable hex string
|
||||||
class String
|
class String
|
||||||
|
|
|
@ -18,7 +18,7 @@ along with sofSIM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Copyright (C) 2011 Kevin "tsaitgaist" Redon kevredon@mail.tsaitgaist.info
|
Copyright (C) 2011 Kevin "tsaitgaist" Redon kevredon@mail.tsaitgaist.info
|
||||||
=end
|
=end
|
||||||
require './sap/server.rb'
|
require_relative 'sap/server'
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
require 'smartcard'
|
require 'smartcard'
|
||||||
=begin
|
=begin
|
||||||
|
|
|
@ -19,7 +19,7 @@ Copyright (C) 2011 Kevin "tsaitgaist" Redon kevredon@mail.tsaitgaist.info
|
||||||
=end
|
=end
|
||||||
# this is the client part of the SAP
|
# this is the client part of the SAP
|
||||||
# it implements the state machine for the client
|
# it implements the state machine for the client
|
||||||
require './sap/common.rb'
|
require_relative 'common'
|
||||||
|
|
||||||
# this is an abstract class
|
# this is an abstract class
|
||||||
# TODO :
|
# TODO :
|
||||||
|
|
|
@ -20,7 +20,7 @@ Copyright (C) 2011 Kevin "tsaitgaist" Redon kevredon@mail.tsaitgaist.info
|
||||||
# this is the server part of the SAP
|
# this is the server part of the SAP
|
||||||
# it implements the state machine for the server
|
# it implements the state machine for the server
|
||||||
# this is an abstract class
|
# this is an abstract class
|
||||||
require './sap/common.rb'
|
require_relative 'common'
|
||||||
|
|
||||||
# this is an bastract class
|
# this is an bastract class
|
||||||
# TODO (not implemented) :
|
# TODO (not implemented) :
|
||||||
|
|
|
@ -18,8 +18,8 @@ along with sofSIM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Copyright (C) 2011 Kevin "tsaitgaist" Redon kevredon@mail.tsaitgaist.info
|
Copyright (C) 2011 Kevin "tsaitgaist" Redon kevredon@mail.tsaitgaist.info
|
||||||
=end
|
=end
|
||||||
require './sap/server.rb'
|
require_relative 'sap/server'
|
||||||
require './lib/apdu.rb'
|
require_relative 'lib/apdu'
|
||||||
require 'socket'
|
require 'socket'
|
||||||
require 'xml'
|
require 'xml'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue