-
Notifications
You must be signed in to change notification settings - Fork 4
/
file.py
executable file
·1161 lines (929 loc) · 33 KB
/
file.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import sys
import time
import base64
from Peach.Engine.engine import Engine
from Peach.Engine.dom import State, Action
from Peach.publisher import Publisher
try:
import win32pdh
import win32pdhutil
import win32pdhquery
import ctypes
import win32api
except:
pass
class FileWriter(Publisher):
"""
Publishes generated data to a file. No concept of receaving data
yet.
"""
def __init__(self, filename):
"""
@type filename: string
@param filename: Filename to write to
"""
Publisher.__init__(self)
self._filename = None
self._fd = None
self._state = 0 # 0 = stopped; 1 = started
self.setFilename(filename)
def getFilename(self):
"""
Get current filename.
@rtype: string
@return: current filename
"""
return self._filename
def setFilename(self, filename):
"""
Set new filename.
@type filename: string
@param filename: Filename to set
"""
self._filename = filename
def start(self):
pass
def connect(self):
if self._state == 1:
raise Exception('File::start(): Already started!')
if self._fd is not None:
self._fd.close()
self.mkdir()
self._fd = open(self._filename, "w+b")
self._state = 1
def stop(self):
self.close()
def mkdir(self):
# lets try and create the folder this file lives in
dir = os.path.join(os.getcwd(), os.path.dirname(self._filename))
if not os.path.isdir(dir) and len(dir):
os.makedirs(dir)
def close(self):
if self._state == 0:
return
self._fd.close()
self._fd = None
self._state = 0
def send(self, data):
if type(data) != str:
data = data.encode('iso-8859-1')
self._fd.write(data)
def receive(self, size=None):
if size is not None:
return self._fd.read(size)
return self._fd.read()
class FileWriterAS3StringRecorder(Publisher):
"""
Record all test cases one per line, 32bit integer prefix to line
indicating read length.
"""
def __init__(self, filename):
"""
@type filename: string
@param filename: Filename to write to
"""
Publisher.__init__(self)
self._filename = None
self._fd = None
self._state = 0 # 0 -stoped; 1 -started
self.setFilename(filename)
def getFilename(self):
"""
Get current filename.
@rtype: string
@return: current filename
"""
return self._filename
def setFilename(self, filename):
"""
Set new filename.
@type filename: string
@param filename: Filename to set
"""
self._filename = filename
def start(self):
pass
def connect(self):
if self._fd is not None:
return
self.mkdir()
self._fd = open(self._filename, "w+b")
self._state = 1
def stop(self):
#if self._state == 0:
# return
#
#self._fd.close()
#self._fd = None
#self._state = 0
pass
def mkdir(self):
# lets try and create the folder this file lives in
dir = os.path.join(os.getcwd(), os.path.dirname(self._filename))
if not os.path.isdir(dir) and len(dir):
os.makedirs(dir)
def close(self):
pass
def send(self, data):
self._fd.write(" <string>" + base64.b64encode(data) + "</string>\n")
def receive(self, size=None):
if size is not None:
return self._fd.read(size)
return self._fd.read()
class FileWriterAS3NumberRecorder(Publisher):
"""
Record all test cases one per line, 32bit integer prefix to line
indicating read length.
"""
def __init__(self, filename):
"""
@type filename: string
@param filename: Filename to write to
"""
Publisher.__init__(self)
self._filename = None
self._fd = None
self._state = 0 # 0 -stoped; 1 -started
self.setFilename(filename)
def getFilename(self):
"""
Get current filename.
@rtype: string
@return: current filename
"""
return self._filename
def setFilename(self, filename):
"""
Set new filename.
@type filename: string
@param filename: Filename to set
"""
self._filename = filename
def start(self):
pass
def connect(self):
if self._fd is not None:
return
self.mkdir()
self._fd = open(self._filename, "w+b")
self._state = 1
def stop(self):
pass
def mkdir(self):
# lets try and create the folder this file lives in
dir = os.path.join(os.getcwd(), os.path.dirname(self._filename))
if not os.path.isdir(dir) and len(dir):
os.makedirs(dir)
def close(self):
pass
def send(self, data):
buff = " <number>" + data + "</number>\n"
self._fd.write(buff)
def receive(self, size=None):
if size is not None:
return self._fd.read(size)
return self._fd.read()
class FileReader(Publisher):
"""
Publishes generated data to a file. No concept of receaving data
yet.
"""
def __init__(self, filename):
"""
@type filename: string
@param filename: Filename to write to
"""
Publisher.__init__(self)
self._filename = None
self._fd = None
self._state = 0 # 0 -stoped; 1 -started
self.setFilename(filename)
def getFilename(self):
"""
Get current filename.
@rtype: string
@return: current filename
"""
return self._filename
def setFilename(self, filename):
"""
Set new filename.
@type filename: string
@param filename: Filename to set
"""
self._filename = filename
def start(self):
pass
def connect(self):
if self._state == 1:
return
if self._fd is not None:
self._fd.close()
self._fd = open(self._filename, "r+b")
self._state = 1
def stop(self):
self.close()
def close(self):
try:
if self._state == 0:
return
self._fd.close()
self._fd = None
self._state = 0
except:
pass
def send(self, data):
self._fd.write(data)
def receive(self, size=None):
if size is not None:
return self._fd.read(size)
return self._fd.read()
class FilePerIteration(FileWriter):
"""
This publisher differs from File in that each round
will generate a new filename. Very handy for generating
bogus content (media files, etc).
"""
def __init__(self, filename):
"""
@type filename: string
@param filename: Filename to write to should have a %d in it
someplace :)
"""
FileWriter.__init__(self, filename)
self._roundCount = 0
self._origFilename = filename
self.setFilename(filename % self._roundCount)
self._closed = True
self.data = None
self.dataLookedFor = False
def _getStateByName(self, stateMachine, stateName):
"""
Locate a State object by name in the StateMachine.
"""
for child in stateMachine:
if child.elementType == 'state' and child.name == stateName:
return child
return None
def _getDataWithFileName(self):
"""
Will search state model for a <Data> and get the
filename from it.
"""
stateMachine = self.parent.stateMachine
for state in stateMachine:
if isinstance(state, State):
for action in state:
if isinstance(action, Action):
if action.data is not None and action.data.fileName is not None:
return action.data
return None
def connect(self):
if self.data is None and self.dataLookedFor == False:
self.data = self._getDataWithFileName()
self.dataLookedFor = True
if self.data is not None:
fileBase = self.data.fileName
if fileBase.find('\\'):
fileBase = fileBase.split('\\')[-1]
if fileBase.find('/'):
fileBase = fileBase.split('/')[-1]
fileBase = fileBase.split('.')[0]
self.setFilename((self._origFilename % self._roundCount).replace("##FILEBASE##", fileBase))
else:
self.setFilename(self._origFilename % self._roundCount)
FileWriter.connect(self)
self._closed = False
def stop(self):
self.close()
def close(self):
FileWriter.close(self)
if not self._closed:
self._roundCount += 1
if self.data is not None:
fileBase = self.data.fileName
if fileBase.find('\\'):
fileBase = fileBase.split('\\')[-1]
if fileBase.find('/'):
fileBase = fileBase.split('/')[-1]
fileBase = fileBase.split('.')[0]
self.setFilename((self._origFilename % self._roundCount).replace("##FILEBASE##", fileBase))
else:
self.setFilename(self._origFilename % self._roundCount)
self._closed = True
def send(self, data):
FileWriter.send(self, data)
class FileWriterLauncher(Publisher):
"""
Writes a file to disk and then launches a program.
To use, first use this publisher like the FileWriter
stream publisher. Close, than call a program (or two).
"""
def __init__(self, filename, debugger="False", waitTime=3):
"""
@type filename: string
@param filename: Filename to write to
@type waitTime: integer
@param waitTime: Time in seconds to wait before killing process
"""
Publisher.__init__(self)
self._filename = None
self._fd = None
self._state = 0 # 0 -stoped; 1 -started
self.setFilename(filename)
self.waitTime = float(waitTime)
self.debugger = False
if debugger.lower() == "true":
self.debugger = True
def getFilename(self):
"""
Get current filename.
@rtype: string
@return: current filename
"""
return self._filename
def setFilename(self, filename):
"""
Set new filename.
@type filename: string
@param filename: Filename to set
"""
self._filename = filename
def start(self):
pass
def connect(self):
if self._state == 1:
raise Exception('File::start(): Already started!')
if self._fd is not None:
self._fd.close()
self.mkdir()
self._fd = open(self._filename, "w+b")
self._state = 1
def stop(self):
self.close()
def mkdir(self):
# lets try and create the folder this file lives in
dir = os.path.join(os.getcwd(), os.path.dirname(self._filename))
if not os.path.isdir(dir) and len(dir):
os.makedirs(dir)
def close(self):
if self._state == 0:
return
self._fd.close()
self._fd = None
self._state = 0
def send(self, data):
self._fd.write(data)
def receive(self, size=None):
if size is not None:
return self._fd.read(size)
return self._fd.read()
def FindChildrenOf(self, parentid):
childPids = []
object = "Process"
items, instances = win32pdh.EnumObjectItems(None, None, object, win32pdh.PERF_DETAIL_WIZARD)
instance_dict = {}
for instance in instances:
if instance in instance_dict:
instance_dict[instance] += 1
else:
instance_dict[instance] = 0
for instance, max_instances in instance_dict.items():
for inum in range(max_instances + 1):
hq = win32pdh.OpenQuery()
try:
hcs = []
path = win32pdh.MakeCounterPath((None, object, instance, None, inum, "ID Process"))
hcs.append(win32pdh.AddCounter(hq, path))
path = win32pdh.MakeCounterPath((None, object, instance, None, inum, "Creating Process ID"))
hcs.append(win32pdh.AddCounter(hq, path))
try:
# If the process goes away unexpectedly this call will fail
win32pdh.CollectQueryData(hq)
type, pid = win32pdh.GetFormattedCounterValue(hcs[0], win32pdh.PDH_FMT_LONG)
type, ppid = win32pdh.GetFormattedCounterValue(hcs[1], win32pdh.PDH_FMT_LONG)
if int(ppid) == parentid:
childPids.append(int(pid))
except:
pass
finally:
win32pdh.CloseQuery(hq)
return childPids
def call(self, method, args):
# windows or unix?
if sys.platform == 'win32':
return self.callWindows(method, args)
return self.callUnix(method, args)
def callUnix(self, method, args):
"""
Launch program to consume file
@type method: string
@param method: Command to execute
@type args: array of objects
@param args: Arguments to pass
"""
## Make sure we close the file first :)
self.close()
## Figure out how we are calling the program
if self.debugger:
# Launch via agent
Engine.context.agent.OnPublisherCall(method)
methodRunning = method + "_isrunning"
for i in range(int(self.waitTime / 0.25)):
ret = Engine.context.agent.OnPublisherCall(methodRunning)
if not ret:
# Process exited already
break
time.sleep(0.25)
else:
# Launch via spawn
#realArgs = [os.path.basename(method)]
realArgs = [method]
for a in args:
realArgs.append(a)
pid = os.spawnv(os.P_NOWAIT, method, realArgs)
for i in range(0, int(self.waitTime / 0.15)):
(pid1, ret) = os.waitpid(pid, os.WNOHANG)
if not (pid1 == 0 and ret == 0):
break
time.sleep(0.15)
try:
import signal
os.kill(pid, signal.SIGTERM)
time.sleep(0.25)
(pid1, ret) = os.waitpid(pid, os.WNOHANG)
if not (pid1 == 0 and ret == 0):
return
os.kill(pid, signal.SIGKILL)
except:
print(sys.exc_info())
def callWindows(self, method, args):
"""
Launch program to consume file
@type method: string
@param method: Command to execute
@type args: array of objects
@param args: Arguments to pass
"""
## Make sure we close the file first :)
self.close()
## Figure out how we are calling the program
if self.debugger:
# Launch via agent
Engine.context.agent.OnPublisherCall(method)
methodRunning = method + "_isrunning"
for i in range(int(self.waitTime / 0.25)):
ret = Engine.context.agent.OnPublisherCall(methodRunning)
if not ret:
# Process exited already
break
time.sleep(0.25)
else:
# Launch via spawn
realArgs = ["cmd.exe", "/c", method]
for a in args:
realArgs.append(a)
phandle = os.spawnv(os.P_NOWAIT, os.path.join(os.getenv('SystemRoot'), 'system32', 'cmd.exe'), realArgs)
# Give it some time before we KILL!
for i in range(int(self.waitTime / 0.25)):
if win32process.GetExitCodeProcess(phandle) != win32con.STILL_ACTIVE:
# Process exited already
break
time.sleep(0.25)
try:
pid = ctypes.windll.kernel32.GetProcessId(ctypes.c_ulong(phandle))
if pid > 0:
for cid in self.FindChildrenOf(pid):
chandle = win32api.OpenProcess(1, 0, cid)
win32process.TerminateProcess(chandle, 0)
try:
win32api.CloseHandle(chandle)
except:
pass
win32process.TerminateProcess(phandle, 0)
try:
win32api.CloseHandle(phandle)
except:
pass
except:
pass
try:
import win32gui, win32con, win32process, win32event, win32api
import sys, time, os, signal, subprocess, ctypes
TH32CS_SNAPPROCESS = 0x00000002
class PROCESSENTRY32(ctypes.Structure):
_fields_ = [("dwSize", ctypes.c_ulong),
("cntUsage", ctypes.c_ulong),
("th32ProcessID", ctypes.c_ulong),
("th32DefaultHeapID", ctypes.c_ulong),
("th32ModuleID", ctypes.c_ulong),
("cntThreads", ctypes.c_ulong),
("th32ParentProcessID", ctypes.c_ulong),
("pcPriClassBase", ctypes.c_ulong),
("dwFlags", ctypes.c_ulong),
("szExeFile", ctypes.c_char * 260)]
class FileWriterLauncherGui(Publisher):
"""
Writes a file to disk and then launches a program. After
some defined amount of time we will try and close the GUI
application by sending WM_CLOSE than kill it.
To use, first use this publisher like the FileWriter
stream publisher. Close, than call a program (or two).
"""
def __init__(self, filename, windowname, debugger="false", waitTime=3):
"""
@type filename: string
@param filename: Filename to write to
@type windowname: string
@param windowname: Partial window name to locate and kill
"""
Publisher.__init__(self)
self._filename = None
self._fd = None
self._state = 0 # 0 -stoped; 1 -started
self.setFilename(filename)
self._windowName = windowname
self.waitTime = float(waitTime)
self.debugger = False
self.count = 0
self._fd_sequential = None
if debugger.lower() == "true":
self.debugger = True
if sys.platform != 'win32':
raise PeachException("Error, publisher FileWriterLauncherGui not supported on non-Windows platforms.")
def getFilename(self):
"""
Get current filename.
@rtype: string
@return: current filename
"""
return self._filename
def setFilename(self, filename):
"""
Set new filename.
@type filename: string
@param filename: Filename to set
"""
self._filename = filename
def start(self):
pass
def connect(self):
if self._state == 1:
raise Exception('File::start(): Already started!')
if self._fd is not None:
self._fd.close()
self.mkdir()
# First lets rename the old file if there is one
try:
os.unlink(self._filename)
except:
pass
# If we can't open the file it might
# still be open. Lets retry a few times.
for i in range(10):
try:
self._fd = open(self._filename, "w+b")
break
except:
try:
os.unlink(self._filename)
except:
pass
if i == 9:
raise
time.sleep(1)
self._state = 1
def stop(self):
self.close()
def mkdir(self):
# lets try and create the folder this file lives in
dir = os.path.join(os.getcwd(), os.path.dirname(self._filename))
if not os.path.isdir(dir) and len(dir):
os.makedirs(dir)
def close(self):
if self._state == 0:
return
if self._fd_sequential is not None:
self._fd_sequential.close()
self.count += 1
self._fd.close()
self._fd = None
self._state = 0
def send(self, data):
self._fd.write(data)
if self._fd_sequential is not None:
self._fd_sequential.write(data)
def receive(self, size=None):
if size is not None:
return self._fd.read(size)
return self._fd.read()
def call(self, method, args):
"""
Launch program to consume file
@type method: string
@param method: Command to execute
@type args: array of objects
@param args: Arguments to pass
"""
proc = None
if self.debugger:
# Launch via agent
Engine.context.agent.OnPublisherCall(method)
methodRunning = method + "_isrunning"
for i in range(int(self.waitTime / 0.25)):
ret = Engine.context.agent.OnPublisherCall(methodRunning)
if not ret:
# Process exited already
break
time.sleep(0.15)
else:
realArgs = [method]
for a in args:
realArgs.append(a)
proc = None
try:
proc = subprocess.Popen(realArgs, shell=True)
except:
print("Error: Exception thrown creating process")
raise
# Wait 5 seconds
time.sleep(self.waitTime)
self.closeApp(proc, self._windowName)
@staticmethod
def enumCallback(hwnd, args):
"""
Will get called by win32gui.EnumWindows, once for each
top level application window.
"""
proc = args[0]
windowName = args[1]
try:
# Get window title
title = win32gui.GetWindowText(hwnd)
# Is this our guy?
if title.find(windowName) == -1:
win32gui.EnumChildWindows(hwnd, FileWriterLauncherGui.enumChildCallback, args)
return
# Send WM_CLOSE message
win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0)
except:
pass
@staticmethod
def enumChildCallback(hwnd, args):
"""
Will get called by win32gui.EnumWindows, once for each
top level application window.
"""
proc = args[0]
windowName = args[1]
try:
# Get window title
title = win32gui.GetWindowText(hwnd)
# Is this our guy?
if title.find(windowName) == -1:
return
# Send WM_CLOSE message
win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0)
except:
pass
#print sys.exc_info()
def genChildProcesses(self, proc):
parentPid = proc.pid
for p in self.genProcesses():
if p.th32ParentProcessID == parentPid:
yield p.th32ProcessID
def genProcesses(self):
CreateToolhelp32Snapshot = ctypes.windll.kernel32.CreateToolhelp32Snapshot
Process32First = ctypes.windll.kernel32.Process32First
Process32Next = ctypes.windll.kernel32.Process32Next
CloseHandle = ctypes.windll.kernel32.CloseHandle
hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)
pe32 = PROCESSENTRY32()
pe32.dwSize = ctypes.sizeof(PROCESSENTRY32)
if Process32First(hProcessSnap, ctypes.byref(pe32)) == win32con.FALSE:
print(sys.stderr, "Failed getting first process.")
return
while True:
yield pe32
if Process32Next(hProcessSnap, ctypes.byref(pe32)) == win32con.FALSE:
break
CloseHandle(hProcessSnap)
def closeApp(self, proc, title):
"""
Close Application by window title
"""
try:
win32gui.EnumWindows(FileWriterLauncherGui.enumCallback, [proc, title])
if proc is not None and not self.debugger:
win32event.WaitForSingleObject(int(proc._handle), 5 * 1000)
for pid in self.genChildProcesses(proc):
try:
handle = win32api.OpenProcess(1, False, pid)
win32process.TerminateProcess(handle, -1)
win32api.CloseHandle(handle)
except:
pass
except:
pass
###class FileRegressionGui(Publisher):
### '''
### Writes a file to disk and then launches a program. After
### some defined amount of time we will try and close the GUI
### application by sending WM_CLOSE than kill it.
###
### To use, first use this publisher like the FileWriter
### stream publisher. Close, than call a program (or two).
### '''
###
### def __init__(self, folder, windowname, debugger = "false", waitTime = 3):
### '''
### @type filename: string
### @param filename: Log folder with PoC files
### @type windowname: string
### @param windowname: Partial window name to locate and kill
### '''
### Publisher.__init__(self)
### self._windowName = windowname
### self.waitTime = float(waitTime)
### self.debugger = False
### if debugger.lower() == "true":
### self.debugger = True
###
### self._files = []
### self._currentFile = 0
###
### ## INSERT CODE TO LOCATE FILES
### ## c:\cygwin\bin\find folder -iname "*.pdf"
### ## put them into self._files
###
### def start(self):
### pass
###
### def connect(self):
### pass
###