ov3rcl0ck 25 Junior Poster

I say make a centralized server with an antivirus; for sake of example lets say the AV is ClamAV, you make a small python script that allows users to send files to that server to be scanned(over a LAN), the server returns a boolean value(true or false) true meaning there is a maleware, false meaning its clean, and if there is a virus found have the client script unmount the drive, log the event, and maybe even set up a realtime notification system. Also set up a network gateway that scans incoming packets from the network. If you don't know python or any other scripting language i suggest you learn, ever good admin has a script language and knows his *NIX.

ov3rcl0ck 25 Junior Poster

Hardware firewalls are still software based, and yes there still can be bugs. Hardware firewalls are used to provide a single firewall for a whole network instead of having one on each computer, it may also save you a bit of resources, but for Linux the firewalls built into the kernel and doesn't really use many resources.

ov3rcl0ck 25 Junior Poster

Amazon has a pretty large range of books and ebooks.

ov3rcl0ck 25 Junior Poster

question is why have a firewall layering a firewall?

ov3rcl0ck 25 Junior Poster

You can always use "clr"(windozes) or "clear"(*NIX) to clear like so,

import os
os.system("clear")

Or you can take a look into curse UIs.

ov3rcl0ck 25 Junior Poster

2.6 has many bugs so i prefer 2.5

2.6 has been out for a while now, its pretty safe to use.

ov3rcl0ck 25 Junior Poster

First off you're generating the discounts wrong, and secondly you're not printing the right variable, thirdly you need to start the if statment with the highest value($1000) otherwise it will be caught by the "if purchased >= 200:" if statement be cause it IS larger than 200. Try this:

purchased = float(raw_input("Enter the total purchased:  $"))




if purchased >= 1000:
    savings = purchased * 0.20
    total=purchased-savings
elif purchased >= 500:
    savings = purchased * 0.15
    total=purchased-savings
elif purchased >= 200:
    savings = purchased * 0.10
    total=purchased-savings


print "Total value of goods: $%.2f" % total

Editor's note: See winmic's earlier post

ov3rcl0ck 25 Junior Poster

A project i had in mind for learning a few things in assembly is redoing some UNIX commands in assembly.

ov3rcl0ck 25 Junior Poster

In order to read the contents of code.txt , you'll need to read the stdin pipe. To access it, use the sys.stdin handle, which you can read from just like an open file handle. You'll need to use the sys module, obviously.

The rest is just coding the cypher.

HTH

alternatively you can just grab the file location as if it was an argument like so:

import sys
f=open(sys.arg[2],'r')

That should do it as well.

ov3rcl0ck 25 Junior Poster

ps if you split by whitespace and you have this "<P>hey, whats up</P>", then your going to get a list like this

ov3rcl0ck 25 Junior Poster

Looks like you're gonna have to program a HTML parser, not the funest but I've done something similar. You're gonna have to loop through and take every thing that starts with < and copy that and everything between the closing including the > into a object in a list, everything that is not surrounded by <> then put it in the list as its own object, when i get home i can write a small sample if you'd like.

ov3rcl0ck 25 Junior Poster

Multiprocessing and threading are fairly similar, in fact multiprocessing is based off the multithreading API. Heres a really really easy example:

from multiprocessing import Process

def f(name):
    print 'hello', name

if __name__ == '__main__':
    p = Process(target=f, args=('bob',)) #inits thread
    p.start() #starts thread
    p.join() #waits untill thread is done
ov3rcl0ck 25 Junior Poster

Multi processing is similar to threading, google "python multiprocess"

ov3rcl0ck 25 Junior Poster
import threading
 
class THREAD(threading.Thread):
	def __init__(self,ARG1,ARG2):
		threading.Thread.__init__(self)
		#If you change the arugments of __init__ modify the bellow also
		self.arg1=ARG1
		self.arg2=ARG2
	def run(self):
		print "RUN"
		#THIS IS WERE YOUR CODE GOES!
ARG1,ARG2=1,2

t=THREAD(ARG1,ARG2)
t.start()
t.join()

Forgot a line. But you do realize this is an example and i posted it so you can adjust it to your needs, if you don't understand it you're not ready for threading, so this script probably won't work, and if it does its not gonna do anything.If you don't understand it you're not ready for threading.

Dixtosa commented: thx +0
ov3rcl0ck 25 Junior Poster

They were both using Python 2.6.2

Well when I ran your script I got a runtime error for something about threads. Are you getting any errors? Is it giving anything, any feedback?

ov3rcl0ck 25 Junior Poster

The only possible way i see this working it different python versions and/or Tkinter versions, or possibly thread module verions, btw I forgot to kick it off with the start function not to mention countless bugs, i'm going to fix if for the sake of doing it if you want me to post it just say something.

ov3rcl0ck 25 Junior Poster

We wont help you, try doing the heavy doing and research by yourself..codes are given for those worth giving for..you haven't tried coding them yet..

Very well put.

ov3rcl0ck 25 Junior Poster

Personally I believe Linux comes with more precautions, like you have to chmod to execute something, and running as root user is almost unheard of.

ov3rcl0ck 25 Junior Poster

Luckily for you I have nothing to do right now, Sooo I made the appropriate changes, tell me how this works:

#! /usr/bin/python

import Tkinter, threading, time
mylabel=None
global mylabel
class marquee(threading.Thread):
	def run(self):
		while self.looping:
			self.text = mylabel['text'][-1] + mylabel['text'][:-1]
			mylabel['text'] = self.text	
			time.sleep(.2)
class MyLab:
	DATA = 'this is the marquee message! '
	START = 'start marquee'
	STOP = 'stop marquee'
	def __init__(self, master):
		self.looping = 1
		self.frame = Tkinter.Frame(master)
		mylabel = Tkinter.Label(self.frame, text = MyLab.DATA, background = 'white')	
		self.start = Tkinter.Button(self.frame, text = MyLab.START, command = self.startit)	
		
		mylabel.pack()
		self.start.pack()
		self.frame.pack()
		
	def startit(self):
		if (self.start['text'] == MyLab.START):
			self.looping = 1
			self.start['text'] = MyLab.STOP
			tr=marquee()
		else:
			self.looping = 0
			self.start['text'] = MyLab.START
#I moved this function to another class which is threaded.
#	def marquee(self):
#		while self.looping:
#			self.text = mylabel['text'][-1] + mylabel['text'][:-1]
#			mylabel['text'] = self.text	
#			time.sleep(.2)	
		
root = Tkinter.Tk()

mymar = MyLab(root)

root.mainloop()

This solved the Runtime error i got before, it should fix your problem.

ov3rcl0ck 25 Junior Poster

Is this your error "RuntimeError: main thread is not in main loop"?
I'd really recommend making another class for marquee and threading that.

ov3rcl0ck 25 Junior Poster

Gribouillis

and where can i donwload thatmodule?

gerard4143
2:D


ov3rcl0ck
I want to have that processes running on another thread and ability to continue doing something else.:)
and
I DONT want just to execute that little script then after it finishes it moves on. :)

ov3rcl0ck, for example, i have code:


...commands1...
...commands2...
call to t.py and imediately go on next command3
...commands3...
...commands4...

and i think separate process is the best in this time :)

First off Subprocess is a default module for python, next subprocess doesn't spawn a new thread, you need the multithreading module that comes default with the interpreter, also knowing object orientated programming will help. Try this little example:

import threading

class THREAD(threading.Thread):
	def __init__(self,ARG1,ARG2):
		#If you change the arugments of __init__ modify the bellow also
		self.arg1=ARG1
		self.arg2=ARG2
	def run(self):
		#THIS IS WERE YOUR CODE GOES!

t=THREAD(ARG1,ARG2)
t.start()
t.join()

The easiest way to do it is make a thread out of a function but this will lose alot of functionality and is a messy way of doing things IMO. Here it is:

import threading,thread

def THREAD(ARG1,ARG2):
	#YOUR CODE
thread.start_new_thread(THREAD, (ARG1,ARG2))
ov3rcl0ck 25 Junior Poster

Awesome thank you. Case closed

ov3rcl0ck 25 Junior Poster

I'm not in the position to debug it right now, since im at school, but I'll try it out later. Multithreading in python is only able to use one core since its only running in one python interperter, however the library multiprocess will spawn another python interpreter thus granting you the ability to run on multiple cores at once.

ov3rcl0ck 25 Junior Poster

I think it cannot hurt to know how a char array works. In my opinion it is something that you should know if you want to become better in C++ programming. And honestly I don't think that Mark knew how to use a char array.

But I agree. A string is easier to use than a char array. But I never said it would be easier with a char array.

He's probably in a class, its best not to get ahead of yourself, let him learn at his own pace.

ov3rcl0ck 25 Junior Poster
#include<iostream>
using namespace std;


int main()

{
    char name;
    int counter;
    
    
    
while (name!="stop")
{
      cout<<"Enter your friend's name (""stop"" to quit): ";
    cin>>name;
      
      cout<<"so you have"<<counter <<"\n\n";
counter ++;
}
cout<<"Go Make some friends you emotional loser!\n";    
    
    
    
    
    
    
    
    
    
      system ("pause") ;
  return 0;
}

In my opinion the cleanest way to do this is just have the user return a blank line when they're done. So "while (name!='')" would do that.

ov3rcl0ck 25 Junior Poster

you're not making much sense... Do you want to have that processes running on another thread so you can continue doing something else? Do you just want to execute that little script then after it finishes it moves on? What are you trying to do EXACTLY?

ov3rcl0ck 25 Junior Poster

TKinter isn't very thread safe. What exactly are you trying to do? If you want to have more than one windows open Tkinter has a solution for that, look up TopLevel for tkinter(I'm not gonna post an example unless i know your problem).

ov3rcl0ck 25 Junior Poster

What are you trying to implement the services into? A CGI script?

ov3rcl0ck 25 Junior Poster

I've done that and a few other things, I've also linked in C programs and used them.

ov3rcl0ck 25 Junior Poster

yeah im popping arguments off the stack. could someone lead me in the right direction?

ov3rcl0ck 25 Junior Poster

I'm extremely new to assembly, and I don't even know if this is the source of my problem could you tell be why it always says argument 2 is larger even though its not. And please Don't criticize my code, I'm new and I'm really not in the mood to deal with it.

section .data
	one: db 'arg1 is larger'
	ol:  equ $-one
	two: db 'arg2 is larger'
	tl:  equ $-two
	three: db 'args are equal'
	thl:  equ $-three
section .text
	global _one ;if arg1 is larger
	global _two ;if arg2 is larger
	global _three ;if they're equal
	global _start ;main function

_start:
	pop ebx
	pop ebx
	pop eax
	pop ebx
	cmp eax,ebx
	jg _one
	cmp ebx,eax
	jg _two
	mov eax,1
	mov eax,0
_one:
	mov eax,4
	mov ebx,1
	mov ecx,one
	mov edx,ol
	int 80h
	mov eax,1
	mov ebx,0
	int 80h
_two:
	mov eax,4
	mov ebx,1
	mov ecx,two
	mov edx,tl
	int 80h
	mov eax,1
	mov ebx,0
	int 80h
_three:
	mov eax,4
	mov ebx,1
	mov ecx,three
	mov edx,thl
	int 80h
	mov eax,1
	mov ebx,0
	int 80h
ov3rcl0ck 25 Junior Poster

First off no ones gonna do your work for you. And you've only posted once, to ask this question, so most likely you were looking for someone to do your work and once that's done you were just going to leave; Taking and not giving.

ov3rcl0ck 25 Junior Poster

So when I take an argument off the stack it seems that is in the form of a string, is there a way i can convert it to a integer so i can "cmp" it with another argument which i also wish to convert to an int? I am a newbie to ASM but i do realize this isn't going to be as easy as it is in higher level languages. Any help?

ov3rcl0ck 25 Junior Poster

Like I said in former comments on your articles. If we keep making Linux more and more user friendly its not going to suit the needs of the original tech saavy users. And this has already started to take effect, I mean look at Gnome, its tries to integrate as many command line features as it can which makes it less flexible, and never encourages a user to learn shell commands, and if you never learn shell commands then why do you us linux?

ov3rcl0ck 25 Junior Poster

I think you have to use the seek() function to set the offset in your file, try this maybe.

fin = open ("origDict.txt", "r")
fout = open ("newDict.txt", "w")
lif = 0 # Lines in original file
lpp = 72 # Lines per page. Default value, look at user selection later
lpa = 1 # Line pointer a
lpb = lpp # Line pointer b. This is effectively the offset.
pc  = 1 # Pages completed. Incremented each time


linelist = fin.readlines() # Reads the origDict.txt file as a list of lines
lif = len(linelist)
print lif

while lpa != (lpp * pc ): # Loop until 1st page is complete
    fin.seek(lpa)
    lineA = fin.readline.strip() # Read line indicated by pointer a and delete CR
    fin.seek(lpb)
    lineB = fin.readline # Read line indicated by pointer b
    newString = "%s\t%s" % (lineA, lineB)
    fout.write (newString) # write string to newDict
    print newString
ov3rcl0ck 25 Junior Poster

Are you sure the cookie gets put into your browser, because im pretty sure cookielib is for use with urllib/2 and httplib. However you could probably save a cookie in the right format to your browsers cookie cache. I might be wrong, but i doubt cookielib has anything to do with your Web Browser, once again its for use with HTTPlib and urllib 1 and 2.

ov3rcl0ck 25 Junior Poster

Thank you :)

No problem. So case closed? Mark one down as solve ;P

ov3rcl0ck 25 Junior Poster

Oh an another thing to try is CD to the program files, then call os.system

os.chdir("C:/Program Files/Winamp")
os.system("Winamp.exe")
ov3rcl0ck 25 Junior Poster

Its actually not as tough as people are making it out to be, if you have a space you need to put ' ' or " " around it to clarify that it has a space, maybe try this:

import os
os.system("'C:\Winamp\Winamp.exe'")

I may be wrong, i might have just been using Linux too long :P

ov3rcl0ck 25 Junior Poster

Ok, Where can i dwnld it?


And why is your name linux and you have XP?

Many people run Linux for programming boxes, servers, gateways, yet they still use XP as there recreational OS. I however go all out *NIX. Just a matter of preference.

ov3rcl0ck 25 Junior Poster

I'm extremely new to assembly and was wondering if there is a speed difference between 16, 32, and 64bit registers.

ov3rcl0ck 25 Junior Poster

hmm, my bad. Most modules beginning with C are reimplementations in C, they do this for quite a few modules.

ov3rcl0ck 25 Junior Poster

You must know lower level C, and I'd recommend a little knowledge in assembly. Also another good book is "Professional Linux Kernel Architecture". Linux Kernel programming isn't easy to buckle down your sanity, and try not to turn into Richard Stallman.

ov3rcl0ck 25 Junior Poster

Proprietary drivers may be the only solution, wireless drivers are a well kept secret. I'd recommend installing the proprietary driver but if that fails you look into Ndiswrapper.

ov3rcl0ck 25 Junior Poster

I've been using Linux for a long time and noticed that it is a lot harder to exploit loop holes in it, to run an executable it must be Chmoded, to access gain write access to anything out side of your home folder you must be root, and security holes are patched much much faster than on Windows.

ov3rcl0ck 25 Junior Poster

This should do it, urllib should do all the dirty work, even with cookies, I've used this before to auto login, works perfectly

import urllib2,urllib
o = urllib2.build_opener( urllib2.HTTPCookieProcessor() )
urllib2.install_opener(o)
id='kimok222'
pw='1qaz2wsx'
p=urllib.urlencode({"id" : id, "pwd" : pw})
f=o.open("hxxps://login.plaync.co.kr/login/login", p)
data=f.read()
f.close()
#now to request something while logged in use this
#f=o.open()
#data=f.read()
#f.close()
ov3rcl0ck 25 Junior Poster

please tell me that there is a difference because i've spent an entire week figuring out how to make cTurtle work. Now that I have succeeded, both modules appears to have the same functions.

Please tell me that there is a difference

Thing is THEY DO BOTH DO THE SAME, cTurtle is a reimplementation of turtle but its done in C instead of python thus making it faster, I recommend trying this

try:
   import cTurtle as turtle
except ImportError:
   import turtle

this will import cTurtle as turtle if cTurtle is installed, if its not it just imports turtle.

ov3rcl0ck 25 Junior Poster

hi,
I just created this awesome python application and i want to spread it around, but every one has python.
I was just wondering if I could compile python source into a linux executable like py2exe, and then compile the executable into a .deb installer file.

any help would be appreciated.
thanks, The-ITu

Ok py2exe and Freeze bundle your script in with interpreter, thing is you're making DEB packages, Debian and all most all Linux distros have python installed by default, so you can just pack your script into a DEB, compiling it won't make anything faster, or smoother, infact Freeze stores your scripts into a large array which is not only messy but not the best for performance.

ov3rcl0ck 25 Junior Poster

*Sigh* I don't know if you can't read, or you just skipped some posts, but this isn't supposed to be really complex. I don't know how fast brute force is, but IMO 60 to the power of the amount of characters in the message is a lot of combinations. But another thing that I don't know you understand, is that most people won't have the source code, because it would be on a USB (oh duh!, of course....) If I wanted to do an encryption, giving the source code would be like giving the code to the vault. The final result would just be a lonely string sitting in a text file. You can't expect to have the engine running and the source code.

Well either you're completely ignorant, or you have haven't put much thought into this. If someones in the position in which they can take your encrypted files then they could potentially steal your script, and in seconds they could crack it, i can make a loop that can input ever number from 1-9,000,000,000,000 in under a minute.

ov3rcl0ck 25 Junior Poster

Handle? Like its throwing an exception? You honestly make no sense.