Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 30th, 2004, 08:57 PM
arcsecond arcsecond is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: NYC
Posts: 2 arcsecond User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Socket Security Issues

I'm pretty new to Python but I've written a little script that uses a socket object to connect to another computer and send a few strings. This works in conjunction with a MEL script I wrote. This requires Maya to open a commandPort to interface with the Python script.

The question I have is: are there any security issues to beware of when using sockets and opening ports. What is the scope of this socket? Does it work over the Internet or just a LAN? (it's difficult to test when you only have access to two computers) Any general programming tips would be appreciated as well.

the Python code follows if it makes any difference.

Thanks for any advice.
-James
URL


Code:
import socket
import os

def MCT_sender(text, host, port):
	remoteHostIP = socket.gethostbyname(host)
	localHost = socket.gethostname()

	maya = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
	maya.connect((remoteHostIP, port))

	isMCTopen = "if (!`window -exists MCTWin`) \n\t MCT(\"" + localHost + "\"\n);"
	maya.send(isMCTopen)

	maya.send("$newLine = \"" + localHost + ": " + text + "\\n\";")
	maya.send("scrollField -e -ip 0 -it $newLine historyGrp;\n")

	maya.close()

if __name__ == '__main__':
	import sys
	text = os.path.split(sys.argv[1])[1]
	host = os.path.split(sys.argv[2])[1]
	port = int(os.path.split(sys.argv[3])[1])
	MCT_sender(text,host,port)

Reply With Quote
  #2  
Old July 8th, 2004, 12:13 AM
macaronikazoo's Avatar
macaronikazoo macaronikazoo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: brisbane - australia
Posts: 10 macaronikazoo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hey james, good to see another maya dude in here! i'm learning python at the mo too.

in regards to security, i'm not expert, but opening a port in maya is a big security hole. i believe if your machine is connected to the net, then it will be remotely accessible too (i'd be happy to help u test that if u want). considering u pretty much have access to a command line through maya, its a bit scary.

having said that, anyone wanting to take advantage of that would have to have a working knowledge of mel to exploit the open port tho. and i can't imagine many "crackers" out there would know maya all that well.

Reply With Quote
  #3  
Old July 10th, 2004, 12:03 PM
Grim Archon's Avatar
Grim Archon Grim Archon is offline
Mini me.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: Cambridge, UK
Posts: 783 Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 1488 Folding Title: Novice Folder
Time spent in forums: 3 Days 2 h 15 m 57 sec
Reputation Power: 7
Send a message via MSN to Grim Archon
From the description it sounds like your PCs operate on a LAN.

If your PC with the open socket operates on a private LAN and is not the gateway to the INTERNET then it is unlikely anyone from the INTERNET will be able to access it. All PCs on the LAN have private addresses and it is only the public address of the gateway that is known/visible on the INTERNET.

It is not a problem for PCs on a LAN to access the INTERNET because they are the ones making the request and the gateway knows what to do. In this case the gateway handles the translation between private and public addresses.

Requests for connections from the INTERNET to your private LAN will not happen unless your gateway/firewall knows where to send the requests when they happen.

If the firewall is properly configured the only way to make your machine visible to the public would be for the firewall to open up the specific port and steer any requests on that port directly to the local LAN IP address of your PC.

If you need (secure) access to a private network from the INTERNET then VPN/SSH type technology is what you need which adds a layer of encryption and authentication into the mix.

grim
__________________
*** Experimental Python Markup CGI V2 ***

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Socket Security Issues


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT